Search Results for 'the_excerpt'
-
Search Results
-
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.
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!
Wordpress version: 3.5.1
bbPress version: 2.3
site: http://www.heavenlyz.comApologies 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.
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?
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