isplay Posts on Home Page as Custom Excerpts

Community Forums Forums Design Tips and Tricks isplay Posts on Home Page as Custom Excerpts

This topic is: not resolved

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  nickthegeek 1 year, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #355

    GSmith84
    Participant

    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-content

    And with entry content, show a short excerpt. Any ideas how to go about doing something like that?

    • This topic was modified 2 years ago by  GSmith84. Reason: code tags
    • This topic was modified 2 years ago by  GSmith84. Reason: code tags
    #4294

    nickthegeek
    Keymaster
    Post count: 756

    Sorry 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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.