Search Results for 'code'
-
Search Results
-
WP : 5.0.2
bbPress : 2.5.14
Theme : Custom (built with _S)Hi everyone,
Im trying to build a custom tinyMCE menubar in my forums.
I disabled the text editor and get to a pretty nice ending, but I don’t know why, I just can’t display the “media” and the “emoticons” button.Here is my code :
function bbp_enable_visual_editor( $buttons = array() ) {
$buttons[‘quicktags’] = false;
$buttons[‘tinymce’] = array(
‘toolbar1′ =>’bold, italic, underline, strikethrough, blockquote, bullist, numlist, link, unlink, cleanup, media, image, emoticons’);
return $buttons;
}add_filter( ‘bbp_after_get_the_content_parse_args’, ‘bbp_enable_visual_editor’ );
Other ones are working fine … Any idea ? Im also trying to build a custom spoiler button, without plugins, but I don’t know where to start either …
Cheers,
Champy.
I am trying to allow users to embed videos by using links such as Youtube. When I do so the videos appears but is cut off because the box is to small to fit the iframe that is added to the site when wordpress adds the embed code. You can see an example here: http://b67.3d8.myftpupload.com/no-shift/topic/messed-up-divorce/
I did some searching and found some CSS that doesn’t work either. Basically it adjusts the width but breaks on the height.
.bbp-reply-content { overflow:hidden; padding-bottom:56.25% !important; position:relative; height:0; } .bbp-reply-content iframe{ left:0; top:0; height:100%; width:100%; position:absolute; }Is there a way to make the WordPress auto embed code responsive in BBPress?
Hello,
I have problem. I have on website bbPress with demo data but when i chose some forum or some subpage it’s blank. https://gamenice.sk/forum/
functions.php
<?php show_admin_bar(false); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); function theme_enqueue_scripts() { $template_directory_uri = get_template_directory_uri(); wp_enqueue_style( 'reset', $template_directory_uri . '/assets/css/reset.min.css', false, '1.0' ); wp_enqueue_style( 'app', $template_directory_uri . '/assets/css/app.min.css?v=' . time(), array( 'reset' ), '1.0' ); wp_enqueue_style( 'forum', $template_directory_uri . '/assets/css/forum.min.css?v=' . time(), array( 'app' ), '1.0' ); wp_enqueue_script( 'html5shiv', $template_directory_uri . '/assets/js/html5shiv.min.js' ); wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' ); wp_enqueue_script( 'selectivizr', $template_directory_uri . '/assets/js/selectivizr.min.js' ); wp_script_add_data( 'selectivizr', 'conditional', 'lt IE 9' ); wp_enqueue_script( 'jquery', $template_directory_uri . '/assets/js/jquery.min.js', false, '3.3.1' ); wp_enqueue_script( 'app', $template_directory_uri . '/assets/js/app.js', array( 'jquery' ), '1.0' ); wp_localize_script( 'app', 'carouselSettings', array( 'timeout' => get_option('carousel_timeout').'000' ) ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_scripts' ); function get_excerpt($where = ''){ $excerpt = get_the_content(); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); switch ($where) { case 'carousel': if ( wp_is_mobile() ) $excerpt = substr($excerpt, 0, 120); else $excerpt = substr($excerpt, 0, 250); break; case 'head': $excerpt = substr($excerpt, 0, 200); break; default: if ( wp_is_mobile() ) $excerpt = substr($excerpt, 0, 300); else $excerpt = substr($excerpt, 0, 725); break; } $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); $excerpt = $excerpt.'...'; return $excerpt; } function get_thumbnail_url() { $thumbnail = get_the_post_thumbnail_url() != '' ? get_the_post_thumbnail_url() : get_template_directory_uri() . '/assets/img/og-image.png'; return $thumbnail; } function themename_custom_logo_setup() { $defaults = array( 'height' => 111, 'width' => 220, 'flex-height' => true, 'flex-width' => true, ); add_theme_support( 'custom-logo', $defaults ); } add_action( 'after_setup_theme', 'themename_custom_logo_setup' ); add_theme_support( 'post-thumbnails' ); function register_my_menus() { register_nav_menus( array( 'header-menu' => __( 'Header Menu' ), 'footer-menu' => __( 'Footer Menu' ) ) ); } add_action( 'init', 'register_my_menus' ); function show_menu($menu_name) { $defaults = array( 'theme_location' => '', 'menu' => $menu_name, 'container' => '', 'container_class' => '', 'container_id' => '', 'menu_class' => $menu_name, 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul class="inline-list %2$s">%3$s</ul>', 'depth' => 0, 'walker' => '' ); wp_nav_menu($defaults); } include 'inc/theme-settings.php';forum.php
<?php include 'header.php'; ?> <section class="forum-wrapper"> <div class="container"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php endwhile; endif; ?> </div> </section> <?php include 'footer.php'; ?>I am implementing comment function by AJAX. At the moment
wp insert postis used. However, this function does not have a key for entering three values of “reply attribute”.In other words, I want to input three values “forum ID”, “topic ID” and “Reply To ID” with
wp insert post.It key is like the next “???” .
wp_insert_post(array( 'post_title' => (string)$_POST['replyTitle'], 'post_content' => (string)$_POST['replyContent'], 'post_status' => 'publish', 'post_author' => get_current_user_id(), 'post_type' => 'reply' '???' => (string)$_POST['forumID'], '???' => (string)$_POST['topicID'], '???' => (string)$_POST['replyToID'], ), true);How can I register these three values with
wp insert post?I look forward to your response.
WP : 5.0.2
bbPress : 2.5.14
Theme : Custom (built with _S)Hi everyone,
Im trying to simply display the number of “points” earned by the current user (points = replies + topics), but outside the profile page (in my header actually, so basically on my whole website).
Here is what I tried :
<?php
$topics = bbp_get_user_topic_count_raw();
$replies = bbp_get_user_reply_count_raw();$totalTopics = $topics * 5;
$totalsReplies = $replies * 2;$points = $totalTopics + $totalsReplies;
echo ” points = $points.”;
?>
When Im on the user’s profile page, this code worked lovely, but when Im outside of this page, anywhere on my website, it displays nothing.
Any idea of what is exactly my issue ?Cheers,
Chaaampy.
I want to check if the custom field at reply is “AllowedURL”.
If applicable to “AllowURL”, I would like to have the custom field value go into the database, but can you tell me the correct way to write the following code?
add_action( 'bbp_new_reply', 'bbp_save_reply_extra_fields', 10, 1 ); add_action( 'bbp_edit_reply', 'bbp_save_reply_extra_fields', 10, 1 ); function bbp_save_reply_extra_fields( $reply_id ) { $input_url = $_POST['input_url']; $AllowURL = [ '^http?://example.com/[^/]{10}$', '^http?://example.net/[^/]{20}$' ]; foreach ( $AllowURL as $AU ){ if( @preg_match( '|'.$AU.'|', $input_url ) ) { if ( isset($_POST) && $_POST['input_url']!='' ) { update_post_meta( $reply_id, 'input_url', $_POST['input_url'] ); } } } }I look forward to your response.
Is there a function to specify replyID and get the number of replies to it?
For example, if you have the following HTML, I would like to know about functions that can write “
<?php xxx(100) ?>” and get “2”.<div id="bbpress-forums"> <ul id="topic-1-replies" class="forums bbp-replies"> <li> <div id="post-100"> <p>Hello!</p> </div> <li> <ul class="bbp-threaded-replies"> <li> <div id="post-101"> <p>Hi!</p> </div> <li> <li> <div id="post-102"> <p>Cheers!</p> </div> <li> </ul> </ul> </div>