Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
  • #21003


    Is there a way to automatically reduce the post to a short excerpt for viewing in the blog/catergory area? I would like to just have a list of the posts and images along with the first line of the post rather than the whole post. Currently I have to use a plugin to get this, is there something I can add to the functions?


    Hi eddygame,

    With every post you can use the more tag just after the first sentence and that will tell wordpress where to cut off the preview.





    Hi Devin,

    We are aware of that solution and would like to avoid it, is there not a way to add a simple function to automatically show excerpts on blog/category pages?


    Open up wp-contentthemeschoicesincludesloop-index.php and replace:

    $current_post['content'] 	= get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow">  →</span>');


    $current_post['content'] = get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> &rarr;</span>');
    $current_post['content'] = get_the_excerpt(). '<a href="'.get_the_permalink().'" class="more-link">Read more<span class="more-link-arrow"> &rarr;</span></a>';


    Hi there, where would you replace this exactly? I found the line you mentioned (line 31 in the loop-index.php) but replacing it with the code you gave just breaks everything. Let me know if you have any suggestions, I would definitely like to have shortened excerpts in my category pages / blog listings.



    Hi IMadeItMarket,

    Make sure you’re pasting it in exactly as it is above. PHP can be a bit picky :)




    Hi there, I replaced the line of code with the one you suggested but it is still not working properly. The following is how the code looks after I replaced line #31:

    $current_post = new avia_slideshow($the_id);

    $current_post = get_the_title();


    $current_post = get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> →</span>');


    $current_post = get_the_excerpt(). 'Read more<span class="more-link-arrow"> →</span>';


    $current_post = $subtitle ? "<div class='subtitle_intro'>".apply_filters('the_content',$subtitle)."</div>" : "";

    I know I’m doing something wrong since the code breaks the whole site. Any insight would be fantastic, thanks!!


    Not sure why it’s not working in your case. Try to open up loop-index.php, delete the entire code in the file and insert the code from here:

    If it still doesn’t work please give us more details – “just breaks everything” doesn’t help us to find the problem.


    Hi there, thanks for the code and reply! I copied the code into a new file and gave it a try but still the same results. Anytime the loop-index.php file is loaded on a page when that code is present the whole page loads white; no content whatsoever. It only loads the first two DIVs of the site and no headers. If it would be easier I can give you access to the FTP / WP site, just send me an email.

    I appreciate the help!



    Sorry for delay but these on site visits always take longer then expected. Please send credentials to usjahm (at) gmail (dot) com. Please make sure I can install plugins without a need for ftp login/password , otherwise please provide that as well. Please reference this post in the email and if you have anything else to add, please do. :)




    I also followed IMadeItMarket and Dude’s recommendations but when I reloaded the blog page it was unable to load the blog posts and had written instead:

    Fatal error: Call to undefined function get_the_permalink() in /home/neuro/public_html/trial/wp-content/themes/neurocore/includes/loop-index.php on line 36

    Thoughts on a solution?


    Oh Hi,

    I remember you. Thought you were a hacker emailing me for support lol. You have either a file missing or most likely the directory messed up.

    This file cant be loaded.


    Before we start chopping down the forest lets see if it burns first.

    Also I have 1.7 version of Choices and my line 36 has no code. And the theme doesn’t have this function at all (though that doesn’t mean much since it probably is calling it from framework the roundabout way).




    It only gets an error when using the code from:

    There is a line 36 there:

    $current_post['content'] 	.= '<a href="'.get_the_permalink().'">Read more<span class="more-link-arrow">  →</span></a>';


    This is the code that makes excerpts show up!!!


    $current_post['slider']  	= new avia_slideshow($the_id);
    $current_post['title'] = get_the_title();
    $current_post['content'] = get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> →</span>');
    $current_post['content'] = get_the_excerpt(__('Read more','avia_framework').'<span class="more-link-arrow"> →</span>');
    $current_post['subtitle'] = $subtitle ? "<div class='subtitle_intro'>".apply_filters('the_content',$subtitle)."</div>" : "";


    Glad its working for you now :)

    Let us know if you have any other questions or issues.



Viewing 15 posts - 1 through 15 (of 15 total)

The topic ‘Auto Excerpt Content’ is closed to new replies.