What would be the best way to use the_content as excerpt (with no Read more-link) in a template, and make the -function in the editor work?
I know this probably is Wordpress-specific, but I’m kinda lost. In other themes I’ve used the_content( ‘Read more’ ); to do this, but that doesn’t seem to work with Roots.
This is one of the things that got me when I first started using Roots - there is no archive.php file, so when you’re looking at your blog index, it’s falling back to index.php.
Index.php calls from templates/content.php, so if you want to edit the_excerpt (or the_content) you change it there.
It got me a little twisted because the individual single.php template files has the full loop, but the index.php calls content.php. So that’s probably what you need to check to make this work.
In the home-categories.php-template I’m listing the title and featured image of some articles, and I also wan’t to list an excerpt based on the tag in the article.
the_excerpt gives me, as expected, an excerpt based on a number of words.
the_content gives me the whole article, but I’m trying to get only the content before the tag.
I’m repeating myself here, but now you probably see the problem.
As @mAAdhaTTah said you need to make your changes to templates/content.php as well as any other content templates you’ve created for post formats e.g. templates/content-video.php. Also, I posted this on the Google Group a while back but you may need to customise the conditions:
If that doesn’t work, it’s probably because you have your front page set to a static page, instead of showing your latests posts. Static pages/single posts will ignore the <!--more--> tag unless you tell them otherwise by setting the global $more variable to 0 within the loop (best check the codex to be sure).
Finally, if you’re trying to replicate the excerpts from the Roots site, it doesn’t use the <!--more--> tag at all. I completely overhauled this better excerpts script to get it how we wanted it.
I did try to change content.php without any luck (no difference).
Here’s what I’m trying to do, and how I’m doing it:
I have the front page set to a static page, using a custom template to get rid of the page-header (probably not the best way to do it).
In base.php I’m calling for two different templates, one before the wrap-class, and one after (the reason I’m doing this is for altering the html to make a full-width design, with a similar setup as roots.io), to list articles from different categories.
In these two templates I wan’t to use the_content as the_excerpt, and use the tag in the articles to decide how long the excerpt should be / what it should contain (on the front page).
As you can see the link text generated is “Read more” instead of “Continue Reading” as I had specified.
What’s particularly confusing is that I can’t find the text “Read more” or even “more-link” defined anywhere in the theme or wordpress codebase.
Does anybody know why this might not be working? Without being able to search for the text that’s actually being used on the generated link, I’m not even sure how to debug this.