• Resolved larry91403

    (@larry91403)


    When I add <?php the_excerpt(); ?> I don’t get the correct post excerpt it gives me the excerpt for the page I’m currently on.

    I’m inserting it here:

    <div class="media-body">
    											<p><?php echo '<a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a>'; ?></p><?php the_excerpt(); ?>
    											<span><?php// echo date("M d. Y", strtotime($recent['post_modified'])); ?></span>
    											</div>

    on the index-testimonials.php

    What am I doing wrong? I’m expecting to have the excerpt of that blog post in that section.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter larry91403

    (@larry91403)

    The code got scrubbed above…

    <div class=”media-body”>
    <p><?php echo ‘‘ . $recent[“post_title”].’‘; ?></p><?php the_excerpt(); ?>
    <span><?php// echo date(“M d. Y”, strtotime($recent[‘post_modified’])); ?></span>
    </div>

    Hi,
    Please tell me..
    On Which Page you want excerpt to call?
    What exactly you want ?

    Thread Starter larry91403

    (@larry91403)

    Well, for whatever reason it is already pulling the correct images and titles in that area. If it could just pull the associated excerpts that match those titles and images then everything would be fine.

    It’s just the recent blog posts I’m talking about.

    Hello,

    The testimonial part in the theme comes from the Options Panel.

    All the text-body of the testimonial populated using option anel settings.

    the_excerpt() ; will not work here.

    You want to show limited text right ? Just enter the limited text in the option panel settings.

    Thanks

    Thread Starter larry91403

    (@larry91403)

    Actually, I figured this out… on index-testemonials.php I did the following:

    <div class="span6 recent_blog">
    			<h2><?php if($current_options['recent_blog_title']!='') { echo $current_options['recent_blog_title'];} ?><span><?php if($current_options['recent_blog_description']!='') { echo $current_options['recent_blog_description'];} ?></span></h2>
    			<div class="row">
    				<?php	$args = array( 'numberposts' => '4' );
    						$recent_posts = wp_get_recent_posts( $args );
    						if($recent_posts){
    							foreach( $recent_posts as $recent ){
    								setup_postdata($recent);
    								//echo '
    <pre>';
    								//var_dump($recent);
    								//echo '</pre>
    ';
    								?>
    									<div class="span3">
    										<div id="recent_blog_cols" class="media">
    										<?php if(get_post_thumbnail_id($recent["ID"])!='')
    										      {
    											  		$defalt_arg=array('class'=>'media-object img-circle pull-left recent_blog_thumb');
    											  		echo get_the_post_thumbnail($recent["ID"],'recent-blog-thumb', $defalt_arg);
    											  }else{?>
    													<img src="<?php echo $template_uri .'/testimonial.jpg'; ?>"  class="media-object img-circle pull-left recent_blog_thumb">
    											  <?php
    											  }
    											  ?>
    
    											  <div class="media-body">
    											   	<p><?php echo '<a>' .   $recent["post_title"].'</a>'; ?></p><?php echo string_limit_words($recent["post_content"],10);?>...
    												<span><?php// echo date("M d. Y", strtotime($recent['post_modified'])); ?></span>
    											  </div>
    										</div>
    								</div>
    								<?php } } else { ?>
    								<div class="span3">
    									<div class="media-body">
    									<p><?php _e("NO POST TO DISPLAY...",'busi_prof');?></p>
    									</div>
    								</div>
    								<?php } ?>
    			</div>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    So it now displays text from recent posts and limits the word count in the recent blogs section automatically along with the titles and images.

    Your suggested method would require manual intervention which is not very efficient and would ultimately mean stale content since our less technical users would have to remember to update that options section AND I’d have to trust them with access to it.

    Hi larry

    You want to display limited text in recent blog section.

    In this section the_excerpt(); function not use full.

    Crete first child theme after that follow the given instruction.

    Here i provide another custom function. It work to similar the_excerpt(); function.

    You can find given code in recent blog section
    <div class=”media-body”>
    <p><?php echo ‘‘ . $recent[“post_title”].’‘; ?></p>

    After that add below code in recent blog section
    <p><?php echo $excerpt = substr($recent[‘post_content’], 0, 75); ?></p>

    It will resolve your issue. If you have any confusion let me know.

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Article/blog excerpt’ is closed to new replies.