Forums

Include Post Excerpt ? (5 posts)

  1. JohnEp
    Member
    Posted 2 months ago #

    The plugin works fine however I'd like for it to also display the excerpt from the post in the sidebar as well...I don't want the entire post content to display, just the excerpt...can you please give me the code? Thank you

    http://wordpress.org/extend/plugins/wp-postviews-plus/

  2. fantasyworld
    Member
    Posted 2 months ago #

    You want this plugin can count the post views times when you use the_excerpt(); function to display.
    The most easy way is find
     add_filter('the_content', 'process_postviews');
    and add the code
     add_filter('the_excerpt', 'process_postviews');
    after what you find

    I will do more test, and release a new version

  3. JohnEp
    Member
    Posted 2 months ago #

    What I really need to do is display the post content (ONLY before the <!--more--> tag). I am able to add the entire post content by using "post_content", however I just want to display the content before the <!--more-->...

    I have to edit something here (line 151 in postviews.php):

    if($chars > 0) {
    				foreach ($most_viewed as $post) {
    					$post_title = htmlspecialchars(stripslashes($post->post_title));
    
    					$post_views = intval($post->views);
    					$post_views = number_format($post_views);
    					$temp .= "<li><a href=\"".get_permalink()."\">".snippet_chars($post_title, $chars)."</a></li>\n";
    
    				}
    			} else {
    				foreach ($most_viewed as $post) {
    					$post_title = htmlspecialchars(stripslashes($post->post_title));
    
    					$post_views = intval($post->views);
    					$post_views = number_format($post_views);
    					$temp .= "<li><a href=\"".get_permalink()."\">$post_title</a></li>\n";
    
    				}
  4. JohnEp
    Member
    Posted 2 months ago #

    I cannot find add_filter('the_content', 'process_postviews');

  5. fantasyworld
    Member
    Posted 2 months ago #

    Sorry To You!
    I think you are using WP-PostViews From Lester 'GaMerZ' Chan.
    It,s not the same.

Reply

You must log in to post.

About this Topic