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

    Hi,

    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?

    #109976

    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.

    See: http://en.support.wordpress.com/splitting-content/more-tag/

    Regards,

    Devin

    #109977

    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?

    #109978

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

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

    with:

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

    #109979

    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.

    Thanks!

    #109980

    Hi IMadeItMarket,

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

    Regards,

    Devin

    #109981

    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();

    if(is_single()){

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

    }else{

    $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!!

    #109982

    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: https://gist.github.com/InoPlugs/9112ea56006e6e40b3ad

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

    #109983

    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!

    #109984

    Hi,

    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. :)

    Thanks,

    Nick

    #109985

    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?

    #109986

    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.

    /wp-content/themes/choices/wp-content/themes/neurocore/js/neurocore.js

    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).

    Thanks,

    Nick

    #109987

    It only gets an error when using the code from: https://gist.github.com/InoPlugs/9112ea56006e6e40b3ad

    There is a line 36 there:

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

    #109988

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

    Yay!

    $current_post['slider']  	= new avia_slideshow($the_id);
    $current_post['title'] = get_the_title();
    if(is_single())
    {
    $current_post['content'] = get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> →</span>');
    }else{
    $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>" : "";

    #109989

    Glad its working for you now :)

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

    Regards,

    Devin

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

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