Forums

[resolved] Can't get `the_excerpt()` to display custom excerpt data (5 posts)

  1. lincstrunk
    Member
    Posted 1 year ago #

    I use the bSocial theme.

    Within the index.php file, that theme uses the_excerpt_rss() to display information accompanying its "Top 3" posts placed on the home page.

    This function adds a date stamp in brackets (e.g., [ January 7, 2011; 7:00 pm to 9:00 pm. ] ) to the beginning of the excerpts of posts which correspond to an event.

    I do not want that date stamp, and furthermore would like to have a "read more"-type link which links to the full post page, so I was investigating using the_excerpt() instead of the_excerpt_rss() in the index.php file.

    I have entered custom excerpt text for the posts I am testing, but when I use the_excerpt() in the index.php file, my custom text is not displayed. Instead, the actual main content of the post is shown. Furthermore, what is shown is 100% identical to what is shown if I were to use the_content() instead, even when I use a <!--more--> tag.

    In short, using the_excerpt() within the bSocial theme index.php page Top3 section does not seem to work the way I would expect it to.

    I would like to have help figuring out why I can't get custom excerpt text to display when I use the_excerpt() as described here.

    Incidentally, I get the same results whether I have selected "Full text" or "Summary" in the Reading Settings.

    Thanks for any help you can provide.

    Let me know if more info / settings is needed.

    - Linc

    P.S. In case it helps anybody, this is the relevant code from the bSocial theme index.php. The call to the_excerpt_rss is near the end.

    <div id="top3" class="clearfix">
    	<h3><center>Featured Events and News</center></h3>
    	<?php $my_query = array( 'showposts' => '1', 'cat' => $wp_theme_options['top3_cat_left'] ); $my_query = new WP_Query($my_query); ?>
    	<?php $my_query = "showposts=1&cat=".$wp_theme_options['top3_cat_left']; $my_query = new WP_Query($my_query); ?>
    	<?php if ($my_query->have_posts()) : $my_query->the_post(); ?>
    		<?php $ignore[] = $post->ID; ?>
    		<div class="post">
    		<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    		<?php $thumb_img = portfolio_get_post_image( $post->ID, 'Thumbnail', 278, 100, $crop = false); ?>
    		<?php if ( ! empty( $thumb_img ) ) : ?>
    			<img src="<?php echo $thumb_img; ?>" />
    		<?php endif; ?>
    		<p><?php the_excerpt_rss(); ?></p>
    		</div>
    	<?php endif; ?>
  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    have you contacted the theme author/seller about this issue?

    does the functions.php file of the theme contain any filter regarding the excerpt?

  3. lincstrunk
    Member
    Posted 1 year ago #

    I hadn't contacted the theme author as I didn't believe the issue was with the theme files.

    I have now reviewed the theme files, including functions.php as suggested by alchymyth, and do not see any place where the data returned by "the excerpt" is being filtered or otherwise altered.

    The functions.php file of this theme is relatively short, and doesn't appear to do anything that would affect the results of a call to the_excerpt().

    Thanks for the suggestion.

    -Linc

  4. lincstrunk
    Member
    Posted 1 year ago #

    I found the problem.

    alchymyth got me thinking in the right direction.

    It was not the theme, but a plug-in that was causing the interference.

    The Search Commander WP_Core_Tweaks Plugin has a feature called Post Teaser which has a filter which replaces the excerpt with one of their own making.

    Thanks alchymyth.

    By the way, once I disabled that plugin I discovered that both the_excerpt() and the_excerpt_rss() add that same date stamp to the beginning of the excerpt (unless, of course, it's yet another plugin I have that is doing that!)

    I am marking this as closed, but if anyone has any ideas how to strip off that date stamp, please reply here.

    Cheers,

    Linc

  5. lincstrunk
    Member
    Posted 1 year ago #

    I solved my other problem, too.

    It was another plug-in causing that date stamp to be added: EventCalendar. I tweaked the relevant php file and removed that change.

    Now this item is really closed.

Topic Closed

This topic has been closed to new replies.

About this Topic