-
AuthorPosts
-
August 20, 2013 at 10:08 pm #28145
Gday Kriesi forum
I’d like to automate excerpts on the archive page, rather than the default full post content.
I did read a recent post that was in need of the same but the thread is closed and I didn’t understand the latter steps: https://kriesi.at/support/topic/enfold-archive-exceprts
I placed the archive.php in my child theme includes folder, and modified line 47 to say get_template_part( ‘includes/loop’, ‘archive’ );
But then I’m not sure what to do next. It seemed as though I need to also include the loop-index.php in the child includes and modify that. However, I don’t know what to do to modify that file.
Does anyone know what I need to do here?
Thanks for any help you can provide me.
cheers
Darryl
August 22, 2013 at 6:50 pm #136641Hi Darryl,
Once you’ve followed this step: https://kriesi.at/support/topic/enfold-archive-exceprts#post-120517
If you are in a child theme need to create the includes folder and put the loop-archive.php in it. Now you can edit the loop-archive.php file and where it has the_content change it to the_excerpt.
Regards,
Devin
August 24, 2013 at 11:38 pm #136642Thanks Devin
I followed all the steps and it still delivers the full post. The files are setup in the right folders, I did a test by deliberately breaking the file and it showed an error on the website, so I know it is reading from it.
This is the loop-index line 43 that I’ve edited to include the_excerpt:
$current_post['content'] = str_replace(']]>', ']]>', apply_filters('the_excerpt', $current_post['content'] ));
Should the second argument for ‘content’ be replaced with something else?
cheers
Darryl
August 25, 2013 at 5:04 am #136643You should not be needing to edit anything like that. The loop-archive.php has a single line that reads:
the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> →</span>'); ?>
To WordPress, this means spit out the content and if it has a more tag then break it off there. You need to change it to:
the_excerpt(__('Read more','avia_framework').'<span class="more-link-arrow"> →</span>'); ?>
Which instead attempts to grab the excerpt first.
See: http://codex.wordpress.org/Function_Reference/the_excerpt
The reason I wanted to re-point out this step: https://kriesi.at/support/topic/enfold-archive-exceprts#post-120517 is because you should be working in the loop-archive.php and not the loop-index.php after you make that change.
August 25, 2013 at 7:30 pm #136644Thanks Devin, what a blunder…I totally had the wrong file. Thanks so much for your follow up, you are the best :)
August 25, 2013 at 7:37 pm #136645No worries! Glad its working for you now :)
Let us know if you have any other questions or issues.
Regards,
Devin
-
AuthorPosts
- The topic ‘Archive Excerpts’ is closed to new replies.