Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress injects at wrong position (shorttags + custom page template)

  • @joerga

    Participant

    Hey everyone,

    I am currently setting up a new bbPress Forum and I made a custom template page which works fine but I can’t figure out why the forum injects in the wrong place (or if it works like this at all).

    I have the tagdiv Newspaper Theme installed and I usually layout my pages with the tagdiv composer.
    For the custom page template I took the code from the page.php from the tagdiv Composer directory adjusted it for my needs and then saved it to plugin-bbpress.php inside the Template root directory.

    I also created a page with tagdiv Composer with a layout with three columns, bbPress is supposed to be in the middle one. When I do a static page and add the bbCode shortcode [bbp-forum-index] it works fine and as expected. I have three colums with different content to the left and right and the bbPress forum in the middle.

    What I tried now is to use the same shortcodes from the tagdiv composer to create a custom template for the whole bbPress forum (in. So my code in the plugin-bbpress.php file looks like this:


    if (have_posts()) { ?>
    <?php while ( have_posts() ) : the_post(); ?>

    <div class="td-main-content-wrap td-main-page-wrap td-container-wrap">
    <div class="<?php if (!td_util::tdc_is_installed()) { echo 'td-container '; } ?>tdc-content-wrap">
    <?php echo do_shortcode('[tdc_zone type="tdc_content"][vc_row full_width="stretch_row_1400 td-stretch-content"][vc_column][vc_row_inner][vc_column_inner width="1/3"][td_block_list_menu menu_id="14949"][/vc_column_inner][vc_column_inner width="2/3"][vc_column_text]

    '.the_content().'

    [/vc_column_text][/vc_column_inner][/vc_row_inner][/vc_column][/vc_row][/tdc_zone]'); ?>
    </div>

    </div> <!-- /.td-main-content-wrap -->

    <?php endwhile; ?>
    <?php
    }

    On the frontend the shortcodes are renderd fine by the tagdiv Composer but bbPress injects over or before the columns and not in the middle one as I want it to (and where the the_content() function should place it).

    Any ideas how I can get this to work or any other ideas how to achieve this?

    Thanks!

    Newspaper Version 10.1
    bbPress Version 2.6.4

    Here’s the link to the static page: https://prime-surfing.de/profile-copy/
    And here’s one with the custom page template: https://prime-surfing.de/prime-surfing-forum/forum/prime-surfing/

    P.S.: Please don’t mind the mess with the other pages, still under consutruction.

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

    Moderator

    as a quick guess, I suspect you are trying multiple shortcodes

    so

    
    <?php echo do_shortcode('[tdc_zone type="tdc_content"][vc_row full_width="stretch_row_1400 td-stretch-content"][vc_column][vc_row_inner][vc_column_inner width="1/3"][td_block_list_menu menu_id="14949"][/vc_column_inner][vc_column_inner width="2/3"][vc_column_text]

    might need to be

    <?php echo do_shortcode('[tdc_zone type="tdc_content"]') ;
    <?php echo do_shortcode('[vc_row full_width="stretch_row_1400 td-stretch-content"]') ;
    etc.

    @joerga

    Participant

    Unfortunately this doesn’t work. The function gets then confused with the open and closing tags of the shortcod and echos some of them so the overall layout is broken.

    Any other ideas how to fix this or achieve on another way?

    Here you can see the problem: https://prime-surfing.de/prime-surfing-forum/forum/prime-surfing/

    Edit: I added a second section below this one with this code:

    echo do_shortcode('[tdc_zone type="tdc_content"][vc_row full_width="stretch_row_1400 td-stretch-content"][vc_column][vc_row_inner][vc_column_inner width="1/3"][td_block_list_menu menu_id="14949"][/vc_column_inner][vc_column_inner width="2/3"][vc_column_text]bbPress FORUM SHOULD BE HERE![/vc_column_text][/vc_column_inner][/vc_row_inner][/vc_column][/vc_row][/tdc_zone]');

    This works fine so this tells me that the do_shortcode function interprets all the shortcodes right but something in the injsection of bbPress is not working along with the way I am trying to solve this.

    @robin-w

    Moderator

    can you post your revised template please

    @joerga

    Participant

    Here’s the whole template right now:

    if (have_posts()) { ?>
        <?php while ( have_posts() ) : the_post(); ?>
    
            <div class="td-main-content-wrap td-main-page-wrap td-container-wrap">
                <div class="<?php if (!td_util::tdc_is_installed()) { echo 'td-container '; } ?>tdc-content-wrap">
                     <?php
    
                    echo do_shortcode('[tdc_zone type="tdc_content"]');
                    echo do_shortcode('[vc_row full_width="stretch_row_1400 td-stretch-content"]');
                    echo do_shortcode('[vc_column]');
                    echo do_shortcode('[vc_row_inner]');
    
    echo do_shortcode('[vc_column_inner width="1/3" tdc_css="eyJhbGwiOnsid2lkdGgiOiIyMCUiLCJjb250ZW50LWgtYWxpZ24iOiJjb250ZW50LWhvcml6LWxlZnQiLCJkaXNwbGF5IjoiIn19" is_sticky="yes"]');
                    echo do_shortcode('[td_block_list_menu menu_id="14949"]');
                    echo do_shortcode('[/vc_column_inner]');
                    echo do_shortcode('[vc_column_inner width="1/3" tdc_css="eyJhbGwiOnsid2lkdGgiOiI2MCUiLCJkaXNwbGF5IjoiIn19"]');
                    echo do_shortcode('[vc_column_text]');
                    echo do_shortcode('[bbp-forum-index]');
                       // the_content();
    
                    echo do_shortcode('[/vc_column_text]');
                    echo do_shortcode('[/vc_column_inner]');
                    echo do_shortcode('[vc_column_inner width="1/3" tdc_css="eyJhbGwiOnsid2lkdGgiOiIyMCUiLCJkaXNwbGF5IjoiIn19" is_sticky="yes"]');
                    echo do_shortcode('[vc_column_text]');
    
                    echo do_shortcode('[rs_my_reward_points]');
    
                    echo do_shortcode('[/vc_column_text]');
                    echo do_shortcode('[vc_column_text]');
    
                    echo do_shortcode('[userpro template=activity]');
    
                    echo do_shortcode('[/vc_column_text]');
                    echo do_shortcode('[/vc_column_inner]'); 
                    echo do_shortcode('[/vc_row_inner]'); 
                    echo do_shortcode('[/vc_column]');
                    echo do_shortcode('[/vc_row]');
                    echo do_shortcode('[/tdc_zone]'); 
    
                    ?>
    
                    <?php 
                    echo do_shortcode('[tdc_zone type="tdc_content"][vc_row full_width="stretch_row_1400 td-stretch-content"][vc_column][vc_row_inner][vc_column_inner width="1/3"][td_block_list_menu menu_id="14949"][/vc_column_inner][vc_column_inner width="2/3"][vc_column_text]bbPress FORUM SHOULD BE HERE![/vc_column_text][/vc_column_inner][/vc_row_inner][/vc_column][/vc_row][/tdc_zone]');
                    ?>
                </div>
            </div> <!-- /.td-main-content-wrap -->
    
        <?php endwhile; ?>
    <?php 
        }

    @robin-w

    Moderator

    ok, I’d do this

    go back to

    When I do a static page and add the bbCode shortcode [bbp-forum-index] it works fine and as expected.

    and use developer told to scrape the code from the presented page.

    then you should be able to construct the page without using shortcodes

    too much work for me to really help further for free – sorry

    @joerga

    Participant

    Alright, thanks for the help anyway.

    If anybody else has an idea on how to solve this differently, I am very thankful for every help I get.

    Cheers

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar