Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'the_excerpt'

Viewing 25 results - 1 through 25 (of 31 total)
  • Author
    Search Results
  • #235208
    wpturk
    Participant

    You can change the $before and $after variables to whatever you like. For example an external link before all topics:

    function add_custom_content($content) {
    
        $topic_id = bbp_get_topic_id();
        $user_id = bbp_get_topic_author_id( $topic_id );
    
        if ( bbp_is_user_keymaster($user_id) ) {
    
                $before ='<p>This is my <a href="https://bbpress.org/">EXTERNAL LINK</a>.</p>';
                $after ='<p>TEXT AFTER</p>';
                $content = $before . $content . $after;
        }
        return $content;
    }
    add_filter ('bbp_get_topic_content', 'add_custom_content');

    For the excerpt issue you can give a try with another priority:

    function filter_the_excerpt( ) {
        return ' ';
    }
    add_filter( 'the_excerpt', 'filter_the_excerpt', 999, 2 );
    #235182
    wpturk
    Participant

    Hi, I’ve not used this plugin so I don’t know how it works.

    Maybe the plugin is using the WordPress excerpt, you can try this:

    add_filter( 'the_excerpt', 'filter_the_excerpt', 10, 2 );
        function filter_the_excerpt( ) {
        return ' ';
     }
    #199003

    In reply to: Layout for Categories

    pixelzen
    Participant

    Yes I got that far, not sure how to use modify the following code just for that sepecific category/forum This is the code for the discussion page

    <?php
    /**
    * [g1_bbp_forums] shortcode callback function.
    *
    * @param array $atts
    * @param string $content
    * @return string
    */
    function g1_bbp_forums_shortcode( $atts, $content ) {
    /* We need a static counter to trace a shortcode without the id attribute */
    static $counter = 0;
    $counter++;
    extract( shortcode_atts( array(
    ‘id’ => ”,
    ‘class’ => ”
    ), $atts, ‘g1_bbp_forums’ ) );
    // Compose final HTML id attribute
    $final_id = strlen( $id ) ? $id : ‘g1-bbp-forums-‘ . $counter;
    // Compose final HTML class attribute
    $final_class = array(
    ‘g1-bbp-forums’,
    );
    $final_class = array_merge( $final_class, explode( ‘ ‘, $class ) );
    // Note: private and hidden forums will be excluded via the
    // bbp_pre_get_posts_normalize_forum_visibility action and function.
    $query = new WP_Query( array(
    ‘post_type’ => bbp_get_forum_post_type(),
    ‘post_parent’ => $settings[‘parent_forum’],
    ‘post_status’ => bbp_get_public_status_id(),
    ‘posts_per_page’ => get_option( ‘_bbp_forums_per_page’, 50 ),
    ‘ignore_sticky_posts’ => true,
    ‘no_found_rows’ => true,
    ‘orderby’ => ‘menu_order title’,
    ‘order’ => ‘ASC’
    ) );
    if ( ! $query->have_posts() ) {
    return ”;
    }
    // Start output buffer
    ob_start();
    ?>
    <div class=”<?php echo implode( ‘ ‘, array_map( ‘sanitize_html_class’, $final_class ) ); ?>”>
    <div class=”g1-collection g1-collection–grid g1-collection–one-third g1-collection–simple”>

      <?php while ( $query->have_posts() ) : $query->the_post(); ?>
      <li class=”g1-collection__item”>
      <article>
      <?php if ( has_post_thumbnail() ): ?>
      <figure class=”entry-featured-media”>

      post->ID ); ?>”>
      <?php the_post_thumbnail( ‘g1_one_third’ ); ?>

      </figure>
      <?php else: ?>
      <?php echo do_shortcode( ‘[placeholder icon=”camera” size=”g1_one_third”]’ ); ?>
      <?php endif; ?>
      <div class=”g1-nonmedia”>
      <div class=”g1-inner”>
      <header class=”entry-header”>
      <h3 class=”entry-title”>
      post->ID ); ?>”><?php bbp_forum_title( $query->post->ID ); ?>
      </h3>
      <p class=”entry-meta g1-meta”>
      <span><?php _e( ‘Topics’, ‘bbpress’ ); ?>: <?php bbp_forum_topic_count( $query->post->ID ); ?></span>
      <span><?php bbp_show_lead_topic() ? _e( ‘Replies’, ‘bbpress’ ) : _e( ‘Posts’, ‘bbpress’ ); ?>: <?php bbp_show_lead_topic() ? bbp_forum_reply_count( $query->post->ID ) : bbp_forum_post_count( $query->post->ID ); ?></span>
      </p>
      </header>
      <div class=”entry-summary”>
      <?php the_excerpt(); ?>
      </div>
      </div>
      </div>
      </article>

      <?php endwhile; ?>

    </div>
    </div>
    <?php
    // Reset the $post global
    wp_reset_postdata();
    // Return and flush the output buffer
    return ob_get_clean();
    }
    add_shortcode( ‘g1_bbp_forums’, ‘g1_bbp_forums_shortcode’ );

    #189462
    Robin W
    Moderator

    ok, I can’t help you with winscp, but what you need to achieve is the following.

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/loop-single-forum.php
    bbPress will now use this template instead of the original
    and you can amend this

    so line 38 says

    <div class="bbp-forum-content"><?php bbp_forum_content(); ?></div>

    delete this and in its place put these lines

    <div class="bbp-forum-content">
    		
    		<?php setup_postdata(bbp_get_forum_id()) ; 
    				
    		$excerpt = get_the_excerpt() ;
    		
    		echo $excerpt ;	?>
    		
    </div>

    This will then put the first 55 characters of your content.

    Once you have achieved that, come back and I’ll show you the second part.

    #179126
    Ismail
    Participant

    You’re welcome all. Happy to be able to help 🙂


    @wasanajones
    You can use get_the_excerpt( $se_post ) or just post_excerpt property of the WP_Post object:

    Edit the last callback from previous code to go as this:

    add_filter('bbp_get_form_topic_content', function( $body ) {
    	global $se_post;
    	if( $se_post ) {
    		return $se_post->post_excerpt;
    	}
    	return $body;
    });

    I did not test this but I am sure it should work.

    Best,
    Samuel

    #164256
    PinkishHue
    Participant

    @julia_b (If you’re still waiting for a reply!) – you need to put this in your functions.php file, more info here: https://codex.bbpress.org/functions-files-and-child-themes-explained/

    This works great, thanks so much for sharing this code!

    I’ve also managed, with very little tweaking, to get this displaying replies under topics within the topics list (this is very rough with some bits commented out but pasting here in case it helps someone)

    
    // https://bbpress.org/forums/topic/how-to-add-latest-reply-or-topic-to-forum-list/
    function jagreplies_add_last_reply() { { 
     $jagreplies_last_reply_id = bbp_get_topic_last_reply_id();
     //$jagreplies_last_topic_id = bbp_get_forum_last_topic_id();
    
    $new_args = array(
        'post_type'=> 'reply',
        'p' => $jagreplies_last_reply_id
    );
    $post_title_args = array(
        'post_type'=> 'topic',
        'p' => $jagreplies_last_topic_id
    );
    $other_args = array(
        'post_type'=> 'topic',
        'p' => $jagreplies_last_topic_id
    );
    $jagreplies_query = new WP_Query( $post_title_args );
    $nest_query = new WP_Query( $new_args );
    $another_nest_query = new WP_Query( $other_args );
    
       if ( $jagreplies_query->have_posts() ) : while ( $jagreplies_query->have_posts() ) : $jagreplies_query->the_post();
         $this_post_id=$post->ID;
         $this_post_permalink= get_permalink(); ?>   
                                 
         <!--<a href="<?php //echo $this_post_permalink; ?>">-->
    
    <?php endwhile; 
       endif; wp_reset_query();
    
       if ( $nest_query->have_posts() ) : while ( $nest_query->have_posts() ) : $nest_query->the_post();
         $this_post_id=$post->ID;
         //$this_post_title= get_the_title();
         //$this_post_content= get_the_excerpt(); 
         $this_post_content= the_content(); ?>
    
         <h1><?php echo $this_post_title; ?></h1></a>
         <div class="the_content"><?php echo $this_post_content; ?></div>
                         
       <?php endwhile;
    elseif ( $another_nest_query->have_posts() ) : while ( $another_nest_query->have_posts() ) : $another_nest_query->the_post();
         $this_post_id=$post->ID;
         //$this_post_title= get_the_title();
         //$this_post_content= get_the_excerpt();
         $this_post_content= the_content(); ?>   
                                      
         <!--<h1><?php //echo $this_post_title; ?></h1></a>-->
         <div class="the_content"><?php echo $this_post_content; ?></div>
                         
       <?php endwhile; 
       endif; 
        }} 
    // Hook into action
    add_action('bbp_theme_after_topic_freshness_author','jagreplies_add_last_reply');

    This is extremely useful in creating a ‘Facebook’ style site where all content can be displayed on one single page (I know, Facebook, yuck! But it’s what ‘the people’ like)

    Now I just need to try to get the bbpress Ajax Replies plugin working in conjunction with this so people can post and reply from that single page. Interesting!

    **edited to add – if using my code above you may just want to change the last line ‘bbp_theme_after_topic_freshness_author’ to a different hook depending on where you want to display it, I am using customised templates but I’m not sure how it would look loading the content there if using the default templates

    #155090
    galiulinr
    Participant

    With the CSS does not suit me, do not double content I need to cut in one place. I found the file loop-single-forum.php <div class=”bbp-forum-content”><?php bbp_forum_content(); ?></div> if it would be replaced by the_excerpt, the decision to come to me. I want to see short description

    #150597
    Robkk
    Moderator

    really any plugin that has an included insertable template tag will work.

    im going to use jetpack sharing as an example .

    first i take every instance of each default area jetpack sharing shows.(also jetpack likes)

    function jptweak_remove_share() {
        remove_filter( 'the_content', 'sharing_display',19 );
        remove_filter( 'the_excerpt', 'sharing_display',19 );
        if ( class_exists( 'Jetpack_Likes' ) ) {
            remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
        }
    }
     
    add_action( 'loop_start', 'jptweak_remove_share' );

    and then i could just display it anywhere on the reply. in loop-single-reply.php

    with this

    if ( function_exists( 'sharing_display' ) ) {
        sharing_display( '', true );
    }

    this code also removes it from content like posts and pages. but you can just manually insert it into your wordpress templates to with the above code.

    #146543
    Yukon Cornelius
    Participant

    update: this was undesirable because the link to the reply was going to the reply itself, which is just a single post of the ‘reply’ custom post type. I have created this dodgy hack of the above code so the permalink for the replies is still the topic permalink. I’m sure there are a million better ways to do this, but it does the job for me so i thought i’d share the updated version.

    function jag_add_last_reply() { { 
     $jag_last_reply_id = bbp_get_forum_last_reply_id();
     $jag_last_topic_id = bbp_get_forum_last_topic_id();
    
    $new_args = array(
        'post_type'=> 'reply',
        'p' => $jag_last_reply_id
    );
    $post_title_args = array(
        'post_type'=> 'topic',
        'p' => $jag_last_topic_id
    );
    $other_args = array(
        'post_type'=> 'topic',
        'p' => $jag_last_topic_id
    );
    $jag_query = new WP_Query( $post_title_args );
    $nest_query = new WP_Query( $new_args );
    $another_nest_query = new WP_Query( $other_args );
    
       if ( $jag_query->have_posts() ) : while ( $jag_query->have_posts() ) : $jag_query->the_post();
         $this_post_id=$post->ID;
         $this_post_permalink= get_permalink(); ?>   
                                 
         <a href="<?php echo $this_post_permalink; ?>">
    
    <?php endwhile; 
       endif; wp_reset_query();
    
       if ( $nest_query->have_posts() ) : while ( $nest_query->have_posts() ) : $nest_query->the_post();
         $this_post_id=$post->ID;
         $this_post_title= get_the_title();
         $this_post_content= get_the_excerpt(); ?>
                                 
         <h1><?php echo $this_post_title; ?></h1></a>
         <div class="the_content"><?php echo $this_post_content; ?></div>
                         
       <?php endwhile;
    elseif ( $another_nest_query->have_posts() ) : while ( $another_nest_query->have_posts() ) : $another_nest_query->the_post();
         $this_post_id=$post->ID;
         $this_post_title= get_the_title();
         $this_post_content= get_the_excerpt(); ?>   
                                 
         <h1><?php echo $this_post_title; ?></h1></a>
         <div class="the_content"><?php echo $this_post_content; ?></div>
                         
       <?php endwhile; 
       endif; 
        }} 
    // Hook into action
    add_action('bbp_theme_after_forum_description','jag_add_last_reply');
    Yukon Cornelius
    Participant

    I spent so long trawling google for an answer to this question, so i am sharing what i came up with. It might not be beautiful code (i patched it together from a number of sources), but it works for me.

    Basically, i have a list of forums on my forum home page. I just wanted to show the latest post within each forum as a teaser below the forum description – not just the title, but the excerpt, too. I can’t believe there’s nothing out there explaining how to do this. It seems like a pretty obvious format for the forum index.

    The following snippet will output the latest reply, with post title and post link below the forum description. If there are no replies, it will output the latest topic instead.

    function jag_add_last_reply() { { 
     $jag_last_reply_id = bbp_get_forum_last_reply_id();
     $jag_last_topic_id = bbp_get_forum_last_topic_id();
    $new_args = array(
        'post_type'=> 'reply',
        'p' => $jag_last_reply_id
    );
    $other_args = array(
        'post_type'=> 'topic',
        'p' => $jag_last_topic_id
    );
     
    $nest_query = new WP_Query( $new_args );
    $another_nest_query = new WP_Query( $other_args );
     
       if ( $nest_query->have_posts() ) : while ( $nest_query->have_posts() ) : $nest_query->the_post();
         $this_post_id=$post->ID;
         $this_post_title= get_the_title();
         $this_post_content= get_the_excerpt();
         $this_post_permalink= get_permalink(); ?>   
                                 
         <a href="<?php echo $this_post_permalink; ?>"><h1><?php echo $this_post_title; ?></h1></a>
         <div class="the_content"><?php echo $this_post_content; ?></div>
                         
       <?php endwhile;
    elseif ( $another_nest_query->have_posts() ) : while ( $another_nest_query->have_posts() ) : $another_nest_query->the_post();
         $this_post_id=$post->ID;
         $this_post_title= get_the_title();
         $this_post_content= get_the_content();
         $this_post_permalink= get_permalink(); ?>   
                                 
         <a href="<?php echo $this_post_permalink; ?>"><h1><?php echo $this_post_title; ?></h1></a>
         <div class="the_content"><?php echo $this_post_content; ?></div>
                         
       <?php endwhile; 
       endif; 
        }} 
    // Hook into action
    add_action('bbp_theme_after_forum_description','jag_add_last_reply');

    Just put this in your theme’s functions.php and it should do the trick. Haven’t figured out how to spit out multiple posts and replies for each forum yet, but this is all i needed. Good luck.

    #144999
    Stephen Edgar
    Keymaster

    If when you decide to come back to this you’ll want to use the_excerpt

    https://codex.wordpress.org/Function_Reference/the_excerpt

    There are varios examples scattered throught this site also

    https://bbpress.org/forums/search/the_excerpt/

    #137952
    Stephen Edgar
    Keymaster

    You won’t need this text and/or value that you imported.

    You will have to create your own templates by copying bbPress templates to your theme directory:

    https://codex.bbpress.org/theme-compatibility/

    You would then use the_excerpt rather than the_content to output only ‘x’ words from each topic/reply

    https://codex.wordpress.org/Function_Reference/the_excerpt

    There are a few people who have played around using the_excerpt and bbPress, have a good look around the site to see how and what they did:

    https://bbpress.org/forums/search/the_excerpt/

    #137882
    Stephen Edgar
    Keymaster

    I have a follow up question on the above topic. In the old BB we had each topic showed with a short summary field of the post content (usually just the first X characters of the content). Is there a way to do that with bbPress Forum topics? I do not see any existing widget that does this. In fact, is there even a field mapping for such a thing?

    In WordPress terms this is known as ‘the_excerpt’ and is a function that will only show ‘x’ words of a post, this is not something you can transfer, it is a ‘display’ function in WordPress.

    Oops, forgot another item. I want to bring in topic tags as well. How do I do that.

    These are a little tricky mainly because understanding how they are implemented in WordPress is not an easy task as they are distributed throughout three tables.

    Upload a csv file to http://gist.github.com or http://pastebin.com with a couple of examples of how your data currently has ‘tags’ associated to the topics and I will try to come up with something that is a little clearer than mud for you 😉

    #135361
    SquarePenguin
    Participant

    Hello,

    Could anyone point me in the right direction so I can identify the filters used in bbpress so that I might remove wptexturize?

    I have identified those required for WordPress itself, but bbpress appears to use different filters. The WordPress ones I successfully used are:

    remove_filter( ‘the_title’, ‘wptexturize’ );
    remove_filter( ‘the_content’, ‘wptexturize’ );
    remove_filter( ‘the_excerpt’, ‘wptexturize’ );
    remove_filter( ‘comment_text’, ‘wptexturize’ );

    Which I added to functions.php of a child theme.

    I then identified what I thought were the required filters in bbpress from here:

    http://etivite.com/api-hooks/bbpress/trigger/apply_filters/bbp_get_topic_content/

    …and added the following to functions.php to no effect:

    remove_filter( ‘bbp_get_reply_content’, ‘wptexturize’);
    remove_filter( ‘bbp_get_topic_content’, ‘wptexturize’);

    These filters do not work, so I assume they are not the correct ones. Any ideas what the correct filters are?

    Thank you!

    Heavenlyz
    Participant

    Wordpress version: 3.5.1
    bbPress version: 2.3
    site: http://www.heavenlyz.com

    Apologies if this is considered cross-posting, as this appears as a reply to another thread (but that other thread title isn’t similar). The other thread is… http://bbpress.org/forums/topic/non-functional-index-page-when-bbpress-2-1rc4-is-used-with-woothemes-canvas-5-05/#post-133638

    Ok, so newbie here who knows html and understands coding but is really keen to not screw up the site that someone else has built for me (so apologies if the answer is above and I’m not seeing it).

    The site is http://www.heavenlyz.com and, I think, I’m using the “Nollie” theme.

    I’ve installed bbpress, created a couple of forums and – via the great info on this thread – created a page called “Boardroom”, into which I’ve inserted the “[bbp-forum-index]” shortcode. Hey presto, after much head scratching, I can now see a forum index on http://www.heavenlyz.com/boardroom/…woohoo

    But, my next challenge is to be able to open one of the forums shown. Am struggling with this.

    Having searched, the most relevant answer seems to be… http://bbpress.org/forums/topic/non-functional-index-page-when-bbpress-2-1rc4-is-used-with-woothemes-canvas-5-05/#post-133638

    If you think there is a better (read “easier” 🙂 solution, then please suggest but if not, please read on…

    Because I am using the Nollie theme – I think – the parent/ child argument in that thread doesn’t apply, so am looking at changing the root page.php only (to be honest, I wouldn’t know how to work out whether the child page exists/ how to find the child page).

    In the thread linked to above, Lab says

    Next, change the entry div as shown, to modify the current conditional check to ALSO see if you are on a bbPress page. Without this extra bit, it assumes that you want the page to show the_excerpt() on every page other than single.php …. not true. We want full content on bbPress pages as well

    But my page.php says…

    ID, ‘mfn-post-layout’, true) ) {
    case ‘left-sidebar’:
    $class = ‘ with_aside aside_left’;
    break;
    case ‘right-sidebar’:
    $class = ‘ with_aside aside_right’;
    break;
    default:
    $class = ”;
    break;
    }
    ?>

    Where’s the “entry div”? Apologies if this is a laughably stupid question.

    All help appreciated. N.b. As I’m learning, to start with, I’d rather keep the changes simple and effective rather than complex and golden.

    Heavenlyz
    Participant

    Ok, so newbie here who knows html and understands coding but is really keen to not screw up the site that someone else has built for me (so apologies if the answer is above and I’m not seeing it).

    The site is http://www.heavenlyz.com and, I think, I’m using the “Nollie” theme.

    I’ve installed bbpress, created a couple of forums and – via the great info on this thread – created a page called “Boardroom”, into which I’ve inserted the “[bbp-forum-index]” shortcode. Hey presto, after much head scratching, I can now see a forum index on http://www.heavenlyz.com/boardroom/…woohoo 🙂

    But, my next challenge is to be able to open one of the forums shown. Am struggling with this.

    Because I am using the Nollie theme – I think – the parent/ child argument doesn’t apply, so am looking at changing the root page.php

    Above, Lab says

    Next, change the entry div as shown, to modify the current conditional check to ALSO see if you are on a bbPress page. Without this extra bit, it assumes that you want the page to show the_excerpt() on every page other than single.php …. not true. We want full content on bbPress pages as well

    But my page.php says…

    ID, ‘mfn-post-layout’, true) ) {
    case ‘left-sidebar’:
    $class = ‘ with_aside aside_left’;
    break;
    case ‘right-sidebar’:
    $class = ‘ with_aside aside_right’;
    break;
    default:
    $class = ”;
    break;
    }
    ?>


    <div id="Content" class="subpage”>


    <?php
    if( $class ) echo '’;

    while ( have_posts() )
    {
    the_post();
    get_template_part( ‘includes/content’, ‘page’ );
    }

    if( $class ) echo ”;
    ?>

    Where’s the “entry div”? Apologies if this is a laughably stupid question.

    All help appreciated. N.b. As I’m learning, to start with, I’d rather keep the changes simple and effective rather than complex and golden.

    #133346
    Sami Keijonen
    Participant

    There should be `the_excerpt()` or `the_content()` doesn’t return anything.

    #130916
    eklay
    Participant

    I’ve found the offending filter: ‘bbp_replace_the_content’

    The function bbp_replace_the_content() hijacks the content of any post, regardless of which loop it is in, based simply on whether the page is also the forum archive or topic archive page.

    I was able to get the excerpt for my custom loop, while still preserving the Forum archive on the same page, by using remove_filter( ‘the_content’, ‘bbp_replace_the_content’ ) before the_excerpt() and add_filter( ‘the_content’, ‘bbp_replace_the_content’ ) after.

    #130915
    eklay
    Participant

    @johnnypea – Did you ever get this figured out? Using the_excerpt() anywhere on a BBPress page returns Forum content, even when called within a non-forum custom loop, and then completely clears the $post object… This is very frustrating.

    #121409
    LabSecrets
    Participant

    You have several issues going on here, but they are directly related to your theme. As is very common, it appears to me that your theme has a conditional statement in the template file that builds archive pages. As such, it’s treating the content for bbPress forums as excerpts, as well as applying some unwanted styling.

    Have you tried to build a page using the shortcode method? If so, what was the result? If you found it worked properly, then the issue as suggested above, and you could try to modify your theme or child-theme files to add a similar conditional that looks for bbPress and forces it to use the_content() instead of the_excerpt(). See: https://bbpress.org/forums/topic/non-functional-index-page-when-bbpress-2-1rc4-is-used-with-woothemes-canvas-5-05/

    If this page is being built with shortcodes (I don’t think it is from what I see) then what is the result if you try the default forum index method? We outline both methods in our step by step video here: http://labzip.com/the-definitive-guide-to-buddypress-bbpress-configuration/

    We’ll get you there… 😉

     

     

    LabSecrets
    Participant

    Hi Gang,

    well…. this one through me for a loop today as well, when moving our WooThemes Canvas for bbPress & BuddyPress site for a test drive on bbPress 2.2 ( http://labsecrets.com/demo/canvas-commerce )

    The individual forums would work fine, but the main forum index was rendering what looked like a post excerpt, with everything jumbled into a single paragraph.

    Solution was actually rather simple. If you are using a child-theme in Canvas (you ARE using a child-theme I hope?? 😉  ) simply make a copy of the content-page.php file from parent, and put it into your child-theme folder.

    Next, change the entry div as shown, to modify the current conditional check to ALSO see if you are on a bbPress page. Without this extra bit, it assumes that you want the page to show the_excerpt() on every page other than single.php …. not true. We want full content on bbPress pages as well 😉

    <div class="entry">
    <?php
    /* If this is a bbPress page show full content not exerpt */
    if ( ! is_singular() && (! is_bbPress()) ) {
    the_excerpt();
    } else {
    the_content(__('Continue Reading &rarr;', 'woothemes') );
    }
    wp_link_pages( $page_link_args );
    ?>
    </div><!-- /.entry -->

    With this simple mod, all is well and now the native forums index works, and so does building a custom page with shortcode. Ta da!

    See: http://labsecrets.com/demo/canvas-commerce/forums/

    #111194

    In reply to: Theme malfunction

    Tammy Hart
    Member

    I figured it out. It had something do with me calling the_excerpt_rss in my header.php. removed it, works perfectly!

    #41130
    aravoth2011
    Participant

    Hi everyone. I’ve been trying to display posts from the forum on a static home page so that it gives the appearance of a blog. Basically, I’m using the tewntyeleven theme and I’m using the showcase.php template to display the forum entries.

    you can see what I’m going for here.. http://test.objectsinmotion.org

    So far, I’ve managed to modify it so that super stickies are put in the featured slideshow. The forum posts are displayed properly, and I’ve managed to pull the topic tags. One of the things I’ve been having a lot of trouble with is displaying the forum a topic is posted in as a category. Normally there is a line of text below the topic excerpt that says, “posted in (category name)” . But it seems that nothing I have tried so far is working. In fact, whenever I try to call the forum title, is displays the topic title instead.

    I’m not a programmer, and I know next to nothing about php, I’ve been doing a lot of reading, and trying to learn as much as I can, but I’m just running into a brick wall here. Any help anyone could offer would be much appreciated.

    Showcase.php uses content.php to display all that meta data. right now it looks like this..

    <?php
    /**
    * The default template for displaying content
    *
    * @package WordPress
    * @subpackage Twenty_Eleven
    * @since Twenty Eleven 1.0
    */
    ?>

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
    <?php if ( is_sticky() ) : ?>
    <hgroup>
    <h2 class="entry-title"><a>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <h3 class="entry-format"><?php _e( 'Featured', 'twentyeleven' ); ?></h3>
    </hgroup>
    <?php else : ?>
    <h1 class="entry-title"><a>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    <?php endif; ?>

    <?php if ( 'topic' == get_post_type() ) : ?>
    <div class="entry-meta">
    <?php twentyeleven_posted_on(); ?>
    </div><!-- .entry-meta -->
    <?php endif; ?>

    <?php if ( comments_open() && ! post_password_required() ) : ?>
    <div class="comments-link">
    <?php comments_popup_link( '<span class="leave-reply">' . __( 'Reply', 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
    </div>
    <?php endif; ?>
    </header><!-- .entry-header -->

    <?php if ( is_search() ) : // Only display Excerpts for Search ?>
    <div class="entry-summary">
    <?php the_excerpt(); ?>
    </div><!-- .entry-summary -->
    <?php else : ?>
    <div class="entry-content">
    <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->
    <?php endif; ?>

    <footer class="entry-meta">
    <?php $show_sep = false; ?>
    <?php if ( 'topic' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
    <?php
    /* translators: used between list items, there is a space after the comma */
    $categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
    if ( $categories_list ):
    ?>
    <span class="cat-links">
    <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
    $show_sep = true; ?>
    </span>
    <?php endif; // End if categories ?>
    <?php
    /* translators: used between list items, there is a space after the comma */
    $topic_tags = bbp_get_topic_tag_list( '', __( ', ', 'twentyeleven' ) );
    if ( $topic_tags ):
    if ( $show_sep ) : ?>
    <span class="sep"> | </span>
    <?php endif; // End if $show_sep ?>
    <span class="tag-links">
    <?php printf( __( '<span class="%1$s">Tagged</span> %2$s ', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $topic_tags );
    $show_sep = true; ?>
    </span>
    <?php endif; // End if $topic_tags ?>
    <?php endif; // End if 'topic' == get_post_type() ?>

    <?php if ( comments_open() ) : ?>
    <?php if ( $show_sep ) : ?>
    <span class="sep"> | </span>
    <?php endif; // End if $show_sep ?>
    <span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
    <?php endif; // End if comments_open() ?>

    </footer><!-- #entry-meta -->
    </article><!-- #post-<?php the_ID(); ?> -->

    Other things on my to-do list include making the comments section show number of forum replies instead of number of wordpress comments, and changing the author link so that it goes to the bbpress profile of that user instead of a wordpress post archive.

    For now though, I’m hoping that someone out there can help me with the “category” issue. Anyone have any ideas?

    #40795
    Mr. Salas
    Member

    Hello,

    i used wp 3.2.1 and a theme called wp-basis,

    but after installing bbpress no Forum content is visible.

    There is some generated forum-text in the header of the site

    “<meta name=”description” content=”Topic: DISKUSSION ZUM FILM …etc”

    below is the code of my header.php

    “<meta name=”description” content=”<?php if ( is_single() ) { wp_title(‘-‘, true, ‘right’); echo strip_tags( get_the_excerpt() ); } elseif ( is_page() ) { wp_title(‘-‘, true, ‘right’); echo strip_tags( get_the_excerpt() ); } else { bloginfo(‘description’); } ?>” />”

    i hope somebody can help.

    thx and kind regards

    Daniel

    #110232
    shooo
    Member

    Hello,

    thank you board, I tried, but it doesn’t work.

    I copied this code in my page function.php of my theme. but no widget is created.

    /**
    * bbPress Replies Widget
    *
    * Adds a widget which displays the replies list
    *
    * @since bbPress (r2653)
    *
    * @uses WP_Widget
    */
    class BBP_Replies_Widget2 extends WP_Widget {

    /**
    * Register the widget
    *
    * @since bbPress (r3389)
    *
    * @uses register_widget()
    */
    function register_widget() {
    register_widget( 'BBP_Replies_Widget2' );
    }

    /**
    * bbPress Replies Widget
    *
    * Registers the replies widget
    *
    * @since bbPress (r2653)
    *
    * @uses apply_filters() Calls 'bbp_replies_widget_options' with the
    * widget options
    */
    function BBP_Replies_Widget2() {
    $widget_ops = apply_filters( 'bbp_replies_widget_options', array(
    'classname' => 'widget_display_replies',
    'description' => __( 'balbalbalbalbalbalba.', 'bbpress' )
    ) );

    parent::WP_Widget( false, 'bbPress Reply List 2', $widget_ops );
    }

    /**
    * Displays the output, the replies list
    *
    * @since bbPress (r2653)
    *
    * @param mixed $args
    * @param array $instance
    * @uses apply_filters() Calls 'bbp_reply_widget_title' with the title
    * @uses bbp_set_query_name() To set the query name to 'bbp_widget'
    * @uses bbp_reset_query_name() To reset the query name
    * @uses bbp_has_replies() The main reply loop
    * @uses bbp_replies() To check whether there are more replies available
    * in the loop
    * @uses bbp_the_reply() Loads up the current reply in the loop
    * @uses bbp_get_reply_author_link() To get the reply author link
    * @uses bbp_get_reply_author() To get the reply author name
    * @uses bbp_get_reply_id() To get the reply id
    * @uses bbp_get_reply_url() To get the reply url
    * @uses bbp_get_reply_excerpt() To get the reply excerpt
    * @uses bbp_get_reply_topic_title() To get the reply topic title
    * @uses get_the_date() To get the date of the reply
    * @uses get_the_time() To get the time of the reply
    */
    function widget( $args, $instance ) {

    extract( $args );

    $title = apply_filters( 'bbp_replies_widget_title', $instance['title'] );
    $max_shown = !empty( $instance['max_shown'] ) ? $instance['max_shown'] : '5';
    $show_date = !empty( $instance['show_date'] ) ? 'on' : false;

    // Query defaults
    $replies_query = array(
    'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
    'posts_per_page' => $max_shown,
    'order' => 'DESC'
    );

    // Set the query name
    bbp_set_query_name( 'bbp_widget' );

    // Get replies and display them
    if ( bbp_has_replies( $replies_query ) ) :

    echo $before_widget;
    echo $before_title . $title . $after_title; ?>

    <div id="lastreply">

    <?php while ( bbp_replies() ) : bbp_the_reply(); ?>

    <div class="post">
    <h4>

    <?php
    $author_link = bbp_get_reply_author_link( array( 'type' => 'both', 'size' => 80 ) );
    $reply_link = '<a href="' . esc_url( bbp_get_reply_url() ) . '" title="' . bbp_get_reply_excerpt( bbp_get_reply_id(), 50 ) . '">' . bbp_get_reply_topic_title() . '</a>';

    /* translators: bbpress replies widget: 1: reply author, 2: reply link, 3: reply date, 4: reply time */

    printf( _x( $show_date == 'on' ? '%1$s on %2$s, %3$s, %4$s' : '%1$s on %2$s', 'widgets', 'bbpress' ), $author_link, $reply_link, get_the_date(), get_the_time() );
    ?>

    </h4>
    <?php the_excerpt(); ?>
    <div class="clearfix"></div>
    </div><!-- fin de post -->

    <?php endwhile; ?>

    </div><!-- fin du last reply-->

    <?php echo $after_widget;

    endif;

    bbp_reset_query_name();
    }

    /**
    * Update the forum widget options
    *
    * @since bbPress (r2653)
    *
    * @param array $new_instance The new instance options
    * @param array $old_instance The old instance options
    */
    function update( $new_instance, $old_instance ) {
    $instance = $old_instance;
    $instance['title'] = strip_tags( $new_instance['title'] );
    $instance['max_shown'] = strip_tags( $new_instance['max_shown'] );
    $instance['show_date'] = strip_tags( $new_instance['show_date'] );

    return $instance;
    }

    /**
    * Output the reply widget options form
    *
    * @since bbPress (r2653)
    *
    * @param $instance Instance
    * @uses BBP_Replies_Widget::get_field_id() To output the field id
    * @uses BBP_Replies_Widget::get_field_name() To output the field name
    */
    function form( $instance ) {
    $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
    $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : '';
    $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; ?>

    <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
    <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum replies to show:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo $max_shown; ?>" /></label></p>
    <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $show_date ); ?> /></label></p>

    <?php
    }
    }

    sorry, I feel as bad as otter. :'(

Viewing 25 results - 1 through 25 (of 31 total)
Skip to toolbar