Community Forums › Forums › Archived Forums › Design Tips and Tricks › Excerpts to Home Page – Executive Theme
Tagged: Executive theme, featured content, page excerpts
- This topic has 3 replies, 3 voices, and was last updated 10 years ago by
paultp.
-
AuthorPosts
-
March 28, 2013 at 3:01 am #31691
Vinnie
MemberI am using the Executive Theme to create a website for a customer. On the home page of the Executive theme it allows for a snippet to be placed under each featured image on the page. However, it doesn’t work so well as it draws its content from the first line of the featured pages content, rather than let you customise what that content should be.
My question is, how do I get to customise that content and maybe draw it from the excerpt?
I have installed a page excerpt plugin that draws the content that works with pages. It works well for the slider and draws the custom excerpt into the slide. Is there way of pushing the page excerpt to the home page featured page content?
Thanks
VincentMarch 28, 2013 at 9:19 am #31758Megan Gray
MemberHi Vinnie,
Try downloading this plugin: http://wordpress.org/extend/plugins/genesis-featured-widget-amplified/. If you already have a plugin to add manual excerpts to pages, this featured page widget will allow you to select the manual excerpt rather than just the content limit.
You could also just add this code to your functions.php file, and note that this is also where you'd control the "Read More" type text.
function custom_excerpt($text) { // custom 'read more' link
if (strpos($text, '[...]')) {
$excerpt = strip_tags(str_replace('[...]', '... <a href="'.get_permalink().'">read more...</a>', $text), "<a>");
} else {
$excerpt = '<p>' . $text . '<br/><a href="'.get_permalink().'">Read more...</a></p>';
}
return $excerpt;
}
add_filter('the_excerpt', 'custom_excerpt');
?>Megan
March 28, 2013 at 10:50 am #31785Vinnie
MemberBrilliant Megan and thank you that helped indeed!
I should add though that both ways broke the system and left me with a white screen. However, the idea of the Genesis plugin prompted me to search for another plugin and I eventually opted for the Image widget here: http://wordpress.org/extend/plugins/image-widget/ that worked with a custom snippet on the home page.
VincentJune 10, 2013 at 10:24 am #45058paultp
MemberHi,
For anyone else wanting to do this, I achieved it as follows:
1. Install the http://wordpress.org/plugins/page-excerpt/ to give you an excerpt box on pages (like the one on posts). You can then put what you like in the custom excerpt.
2. Install the http://wordpress.org/extend/plugins/genesis-featured-widget-amplified/ plugin and use it to feature your page.
3. Add the following code to your functions.php to get a read more link (change the read more text to whatever you want). Because the read more link in the amplified plugin only shows up if you select "show content limit".
/** add a read more link to an excerpt **/
function custom_excerpt($text) { // custom 'read more' link
if (strpos($text, '[...]')) {
$excerpt = strip_tags(str_replace('[...]', '... <a href="'.get_permalink().'">[Read More...]</a>', $text), "<a>");
} else {
$excerpt = '<p>' . $text . '<br/><a href="'.get_permalink().'">read more...</a></p>';
}
return $excerpt;
}
add_filter('the_excerpt', 'custom_excerpt');Hope that helps
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.