-
m0nini873Participant
Hey there,
I’ve been using Esplanade (btw, awesome!) for a few months now, and just got around to editing the functions so that it displays a “read more” link at the end of each entry-summary. (I do not manually set up an excerpt, I let it truncate the content automatically – if that matters.)
It seems to work great, except that it’s only working for the four most recent excerpts on the homepage, and not the older entry summaries (there are four older ones). I’m really not sure why. Any direction would be much appreciated! π
noaneoParticipantHi,
Miss not having at the end of the excerpts read more
How can add it?
on the image, we see that the theme does not have this function, damage,
May be the first update of the theme, to rectify this oversight.
Otherwise awesome this theme, full of options!Thank you
Daniel TaraKeymasterHere’s a simple code snippet to add read more links to excerpts:
add_filter( 'the_excerpt', 'esplanade_excerpt_read_more', 30 ); function esplanade_excerpt_read_more( $excerpt ) { $excerpt .= sprintf( '<a href="%s">Read More →</a>', get_permalink() ); return $excerpt; }
- This reply was modified 10 years, 3 months ago by Daniel Tara.
Daniel TaraKeymasterI’m sorry, prefix habbit π I have updated the code prefix to match the esplanade prefix, the code as is applies for any theme though. Yes, it goes in your child theme’s functions.php file.
noaneoParticipantthanks I thought so, I made the change.
-the feature will be added to the next update of the theme?
-Last question, why Read More appears not homepage for 4 posts?
thank you
- This reply was modified 10 years, 3 months ago by noaneo.
Daniel TaraKeymasterNo, this feature will not be added to the theme.
Are you using any post formats for those posts? Did you use the priority specified in the code?
noaneoParticipantGood evening
you will maintain this theme? Do not stop it!
I have not touched the code, the theme files are original, and I added the code as you gave it higher.
The posts have only the normal format
I put in the Grid options, 2 that’s all.
I just put on 3 columns, the layout is the same as your demo for the homepage
http://demo.onedesigns.com/Esplanade/Thank You
Daniel TaraKeymasterThe Esplanade theme will not be discontinued. A permalink to excerpts will not be added by default because this is more a code hack than a feature.
Can you please post a direct link to your website?
noaneoParticipantHello
This is not my site but the site of an association to be precise.
http://arnouvilleetsonpasse.fr/Daniel TaraKeymasterTry increasing the priority for the function above. e.g. from 30 to 999 or some other high number.
noaneoParticipanthi,
add_filter( 'the_excerpt', 'esplanade_excerpt_read_more', 999 ); function esplanade_excerpt_read_more( $excerpt ) { $excerpt .= sprintf( '<a href="%s">Read More →</a>', get_permalink() ); return $excerpt; }
or
add_filter( 'the_excerpt', 'esplanade_excerpt_read_more', 70 ); function esplanade_excerpt_read_more( $excerpt ) { $excerpt .= sprintf( '<a href="%s">Read More →</a>', get_permalink() ); return $excerpt; }
same, no change
thank you
Tagged: entry-summary, excerpt, functions, Read more
You must be logged in to reply to this topic.