Community Forums › Forums › Design Tips and Tricks › isplay Posts on Home Page as Custom Excerpts
This topic contains 1 reply, has 2 voices, and was last updated by nickthegeek 5 months, 2 weeks ago.
-
AuthorPosts
-
November 16, 2012 at 2:42 pm #355
Hello once again Genesis experts,
I already use a bit of custom stuff for the home page, but I’m finding I need to clean it up and adjust it.
I found a potential solution to keep everything very clean using the Advanced Excerpt plugin. But I need to force the posts on the home page to use excerpts.
Here is 1 part of the custom code I am using, and I couldn’t figure out any way to flag the posts as excerpts.
/** Customize Home Page Posts */
add_action( 'pre_get_posts', 'custom_home' );
function custom_home( $query ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'category_name', 'product-list' );
$query->set( 'posts_per_page', '5' );
}
}
The other code I am using changes the formatting of how the featured image displays. To which I’d like to keep that way if possible or if I need to do something special and setup custom excerpts for each post (which I’d rather not do).
add_action( 'genesis_before', 'child_home_condition' );
function child_home_condition() {
if( is_home() || in_category( array( 'reviews', 'products' ) ) ) {
remove_action( 'genesis_post_content', 'genesis_do_post_image' );
add_action( 'genesis_before_post_content', 'custom_home_post', 5 );
function custom_home_post() {
$img = genesis_get_image( array( 'format' => 'html', 'size' => 'home', 'attr' => array( 'class' => 'postimageleft post-image' ) ) );
printf( $img );
}
add_action( 'genesis_before_post_content', 'home_post_ratings', 5 );
function home_post_ratings() {
echo '';
do_action('myrpeditors');
echo '';
}
Essentially I’d like to show the posts on the home page within the same format of genesis loop that exist with my changes.
div post
entry title
featured image
ratingbox
clear
entry-contentAnd with entry content, show a short excerpt. Any ideas how to go about doing something like that?
-
This topic was modified 6 months, 1 week ago by
GSmith84. Reason: code tags
-
This topic was modified 6 months, 1 week ago by
GSmith84. Reason: code tags
December 10, 2012 at 4:05 pm #4294Sorry for teh delay. Did you get this working? If not please share a link to your site. Also, for now could you use a service like pastie.org to share you code. Thanks.
-
This topic was modified 6 months, 1 week ago by
-
AuthorPosts
You must be logged in to reply to this topic.