Community Forums › Forums › Archived Forums › Design Tips and Tricks › Customise content (featured posts)
Tagged: featured post
- This topic has 11 replies, 2 voices, and was last updated 5 years, 7 months ago by
Brad Dalton.
-
AuthorPosts
-
April 25, 2018 at 8:59 pm #219286
LanceHillier
ParticipantHi all,
I'm having a hard time trying to figure out how to customise what content is shown using the featured posts plug in.
Problem: I have added custom styles to the editor, and as part of the posts I have 'by authorname' under the title, I want to remove this from the content preview in featured posts.
I have tried using 'show excerpt'(and writing my own) which works fine but it removes the 'read more' text and I would like to keep this the way it is..
I have tried adding a class to the 'by authername', but the featured post plug in just seems to grab the selected number of characters and wraps it in a <p>..</p> tag so I have had no luck with that.
Any help would be greatly appreciated!!
Lance.
April 26, 2018 at 2:53 pm #219303Brad Dalton
ParticipantGenesis Featured posts widget is native to Genesis not a plugin. Is this what you're referring to?
What do you mean by content preview? Do you mean content limit or excerpts?
April 26, 2018 at 3:55 pm #219317LanceHillier
ParticipantYep sorry should have said the featured content widget, yes the content limit, and the excerpts. I'm trying to remove the first couple of words, it's the Authors name which I put in the editor. I can do it by using the excerpt option but then the read more button is removed( I would like to keep this the way it is) and the content/content limit just grabs everything from the start.
April 26, 2018 at 4:01 pm #219321April 26, 2018 at 5:21 pm #219325LanceHillier
ParticipantThanks Brad,
As soon as I change the featured post widget to show excerpt it removes the 'read more..', by the looks of this code its supposed to add this link back in but it doesn't seem to want to do that for me.
I have just tried your code, and the one I found on wordpress.org.
I also the genesis theme settings to display 'entry excerpts' as per your post with no luck.
not sure, will keep playing!!
April 26, 2018 at 5:35 pm #219326LanceHillier
ParticipantJust to add to this, I am adding my own excerpt from the editor screen
April 26, 2018 at 5:48 pm #219328LanceHillier
ParticipantI have this code that works...
// Changes the behaviour of manual excerpts to include read more link
function all_excerpts_get_more_link($post_excerpt) {
return $post_excerpt . ' ... ID) . '">Read more';
}
add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');But throws this error...
Notice: Undefined variable: post in /Volumes/Design/Website_Design_Jobs/CURRENT JOBS/LOCAL SERVER/writeabetterlife2/wp-content/themes/magazine-pro/functions.php on line 207
Notice: Trying to get property 'ID' of non-object in /Volumes/Design/Website_Design_Jobs/CURRENT JOBS/LOCAL SERVER/writeabetterlife2/wp-content/themes/magazine-pro/functions.php on line 207
Recently I’ve been thinking a lot about what holds us back and the things that prevent us from reaching our goals or taking the risks to move our lives forward. I have been guilty of holding myself back many times, so here are my thoughts and what I’ve lea … Read moreApril 26, 2018 at 5:57 pm #219329LanceHillier
ParticipantOk, this code works...
function all_excerpts_get_more_link($post_excerpt) {
global $post;return $post_excerpt . ' <p>' . __('read more') . '</p>';
}add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');
but places the 'read more' on a new line like so:
Recently I’ve been thinking a lot about what holds us back and the things that prevent us from reaching our goals or taking the risks to move our lives forward. I have been guilty of holding myself back many times, so here are my thoughts and what I’ve lea
read more
I would like this on the end of excerpt like normal, I'm getting closer!
April 26, 2018 at 6:31 pm #219330LanceHillier
ParticipantHi Brad,
I found your code here Force a Read More Link on all Post Excerpts in WordPress
Which is the best yet but it does put the 'read more' like so:
Recently I’ve been thinking a lot about what holds us back and the things that prevent us from reaching our goals or taking the risks to move our lives forward. I have been guilty of holding myself back many times, so here are my thoughts and what I’ve lea
read more
Is there a way to place the 'read more' link onto the end of the excerpt??
April 26, 2018 at 6:41 pm #219331LanceHillier
ParticipantHa,
ok I have it working with code I used from this page..
Thanks Brad, your post has helped me find the right solution, or a solution that works, really helps knowing what to look for.
I wonder now if there is an easy way to omit words from being displayed in the featured post widget, from within the editor?? as that may be an easier solution for me to remove the Author name from the top of the post?
Thanks again,
Lance.April 26, 2018 at 7:59 pm #219332LanceHillier
ParticipantAll good,
thanks Brad! and for anyone else reading my 'thinking out loud' posts!!
Will mark this as solved.
Lance.
April 27, 2018 at 2:14 am #219336Brad Dalton
ParticipantYou could hook the author name in using PHP code rather than adding it to the editor.
-
AuthorPosts
- The topic ‘Customise content (featured posts)’ is closed to new replies.