Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress + Elementor Header

  • @vinem

    Participant

    Hi there,

    I’m building a website with Elementor Pro and bbPress.
    I created 2 different Headers: a main one for the Landing page and blog, and another one for the forums.
    I used the shortcode to display the forums index on a page I’ve built with Elementor and the Header works fine. But when it comes to the automatically created single pages (topic, reply, search, etc.), it displays the main Header.

    I contacted Elementor support, not knowing if the issue was on their side or on yours, and they told me I had to contact you, explaining me this :
    “For your information, we usually find this happening when creating custom post types where it is excluded from showing in menus via the custom post type’s “show_in_nav_menus” option; this option is found in the post type’s “register_post_type” function used to add it in WordPress and may be set to “false” in this case […] we highly recommend contacting the bbPress support team to help with changing this option to “true”. The solution we suspect would be similar to using the function code mentioned in this bbPress support post but with the ‘show_in_nav_menus’ variable set to ‘true’ > https://bbpress.org/forums/topic/plugin-snippet-hack-to-include-bbpress-topics-in-wordpress-search/

    So, here I am! Can someone help me, please?

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • @vinem

    Participant

    Hi again!

    No one to help me?

    Thx!

    @robin-w

    Moderator

    I’ll take a look over the next day or so

    @robin-w

    Moderator

    ok, put this in your child theme’s function file – or use

    Code Snippets

    add_filter( 'bbp_register_topic_post_type', 'rew') ;
    
    function rew ($rew) {
    
    $rew = array(
    				'labels'              => bbp_get_topic_post_type_labels(),
    				'rewrite'             => bbp_get_topic_post_type_rewrite(),
    				'supports'            => bbp_get_topic_post_type_supports(),
    				'description'         => esc_html__( 'bbPress Topics', 'bbpress' ),
    				'capabilities'        => bbp_get_topic_caps(),
    				'capability_type'     => array( 'topic', 'topics' ),
    				'menu_position'       => 555555,
    				'has_archive'         => ( 'forums' === bbp_show_on_root() ) ? bbp_get_topic_archive_slug() : false,
    				'exclude_from_search' => true,
    				'show_in_nav_menus'   => true,
    				'public'              => true,
    				'show_ui'             => current_user_can( 'bbp_topics_admin' ),
    				'can_export'          => true,
    				'hierarchical'        => false,
    				'query_var'           => true,
    				'menu_icon'           => '',
    				'source'              => 'bbpress',
    			)  ;
    			
    return $rew ;
    }
    
    add_filter( 'bbp_register_reply_post_type', 'rew2') ;
    
    function rew2 ($rew) {
    
    $rew2 = array(
    				'labels'              => bbp_get_reply_post_type_labels(),
    				'rewrite'             => bbp_get_reply_post_type_rewrite(),
    				'supports'            => bbp_get_reply_post_type_supports(),
    				'description'         => esc_html__( 'bbPress Replies', 'bbpress' ),
    				'capabilities'        => bbp_get_reply_caps(),
    				'capability_type'     => array( 'reply', 'replies' ),
    				'menu_position'       => 555555,
    				'exclude_from_search' => true,
    				'has_archive'         => false,
    				'show_in_nav_menus'   => true,
    				'public'              => true,
    				'show_ui'             => current_user_can( 'bbp_replies_admin' ),
    				'can_export'          => true,
    				'hierarchical'        => false,
    				'query_var'           => true,
    				'menu_icon'           => '',
    				'source'              => 'bbpress',
    			)  ;
    			
    return $rew2 ;
    }

    @richardwantstoknow

    Participant

    And whereabouts in the functions file do we insert it?

    @richardwantstoknow

    Participant

    Here’s what the child theme looks like now:

    <?php

    function hello_elementor_child_enqueue_scripts() {
    wp_enqueue_style(
    ‘hello-elementor-child’,
    get_stylesheet_directory_uri() . ‘/style.css’,
    [
    ‘hello-elementor’
    ],
    ‘1.0.0’
    );
    }
    add_action( ‘wp_enqueue_scripts’, ‘hello_elementor_child_enqueue_scripts’ );

    function ele_disable_page_title( $return ) {
    return false;
    }
    add_filter( ‘hello_elementor_page_title’, ‘ele_disable_page_title’ );

    =========
    I tried adding your suggested content at the end of the file, but received an error message that stated the functions file had reverted due to an error in line 45. Line 45 was simply a close-bracket “}”.
    ===================

    @robin-w

    Moderator

    just tried it, it is all good, you must have missed a character off somewhere, just add it to the end

    <?php
    function hello_elementor_child_enqueue_scripts() {
    wp_enqueue_style(
    'hello-elementor-child',
    get_stylesheet_directory_uri() . '/style.css',
    [
    'hello-elementor'
    ],
    '1.0.0'
    );
    }
    add_action( 'wp_enqueue_scripts', 'hello_elementor_child_enqueue_scripts' );
    function ele_disable_page_title( $return ) {
    return false;
    }
    add_filter( 'hello_elementor_page_title', 'ele_disable_page_title' );
    add_filter( 'bbp_register_topic_post_type', 'rew') ;
    
    function rew ($rew) {
    
    $rew = array(
    				'labels'              => bbp_get_topic_post_type_labels(),
    				'rewrite'             => bbp_get_topic_post_type_rewrite(),
    				'supports'            => bbp_get_topic_post_type_supports(),
    				'description'         => esc_html__( 'bbPress Topics', 'bbpress' ),
    				'capabilities'        => bbp_get_topic_caps(),
    				'capability_type'     => array( 'topic', 'topics' ),
    				'menu_position'       => 555555,
    				'has_archive'         => ( 'forums' === bbp_show_on_root() ) ? bbp_get_topic_archive_slug() : false,
    				'exclude_from_search' => true,
    				'show_in_nav_menus'   => true,
    				'public'              => true,
    				'show_ui'             => current_user_can( 'bbp_topics_admin' ),
    				'can_export'          => true,
    				'hierarchical'        => false,
    				'query_var'           => true,
    				'menu_icon'           => '',
    				'source'              => 'bbpress',
    			)  ;
    			
    return $rew ;
    }
    
    add_filter( 'bbp_register_reply_post_type', 'rew2') ;
    
    function rew2 ($rew) {
    
    $rew2 = array(
    				'labels'              => bbp_get_reply_post_type_labels(),
    				'rewrite'             => bbp_get_reply_post_type_rewrite(),
    				'supports'            => bbp_get_reply_post_type_supports(),
    				'description'         => esc_html__( 'bbPress Replies', 'bbpress' ),
    				'capabilities'        => bbp_get_reply_caps(),
    				'capability_type'     => array( 'reply', 'replies' ),
    				'menu_position'       => 555555,
    				'exclude_from_search' => true,
    				'has_archive'         => false,
    				'show_in_nav_menus'   => true,
    				'public'              => true,
    				'show_ui'             => current_user_can( 'bbp_replies_admin' ),
    				'can_export'          => true,
    				'hierarchical'        => false,
    				'query_var'           => true,
    				'menu_icon'           => '',
    				'source'              => 'bbpress',
    			)  ;
    			
    return $rew2 ;
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar