• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Post excerpt appearing twice on homepage but only once on category.

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Post excerpt appearing twice on homepage but only once on category.

This topic is: resolved
  • This topic has 2 replies, 2 voices, and was last updated 8 years, 12 months ago by verti.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • June 10, 2014 at 2:28 am #108726
    verti
    Member

    Hi, i have added a bit of code to functions.php(minimum pro child theme) to change to a masonry layout with the following code.

    // =================================================================
    // = Pinterest-like Masonry layout for Posts page and Archives =
    // =================================================================
     
    //* Enqueue and initialize jQuery Masonry script
    function sk_masonry_script() {
    	if (is_home() || is_archive()) {
     
    		wp_enqueue_script( 'masonry-init', get_stylesheet_directory_uri().'/js/masonry-init.js' , array( 'jquery-masonry' ), '1.0', true );
     
     
        	//* Infinite Scroll
        	//wp_enqueue_script( 'infinite-scroll', get_stylesheet_directory_uri().'/js/jquery.infinitescroll.min.js' , array('jquery'), '1.0', true );
        	//wp_enqueue_script( 'infinite-scroll-init', get_stylesheet_directory_uri().'/js/infinitescroll-init.js' , array('jquery'), '1.0', true );
        }
    }
    add_action( 'wp_enqueue_scripts', 'sk_masonry_script' );
     
    //* Add custom body class to the head
    add_filter( 'body_class', 'sk_body_class' );
    function sk_body_class( $classes ) {
    	if (is_home()||is_archive())
    		$classes[] = 'masonry-page';
    		return $classes;
    }
     
    //* Display Post thumbnail, Post title, Post content/excerpt, Post info and Post meta in masonry brick
    add_action('genesis_meta','sk_masonry_layout');
    function sk_masonry_layout() {
    	if (is_home()||is_archive()) {
     
    		//add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
     
    		remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    		remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    		remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
    		remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
     
    		remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    		remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
     
    		remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
     
    		add_action( 'genesis_entry_content', 'sk_masonry_block_post_image', 8 ) ;
    		add_action( 'genesis_entry_content', 'sk_masonry_title_content', 9 );
     
    		//add_action( 'genesis_entry_footer', 'sk_masonry_entry_footer' );
     
    		remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
    		//add_action( 'genesis_before_content', 'genesis_do_breadcrumbs' );
     
    		remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
    		//add_action( 'genesis_before_content', 'genesis_do_taxonomy_title_description', 15 );
     
    		remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 );
    		//add_action( 'genesis_before_content', 'genesis_do_author_title_description', 15 );
     
    		remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive', 15 );
    		//add_action( 'genesis_before_content', 'genesis_do_author_box_archive', 15 );
     
    		remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' );
    		//add_action( 'genesis_before_content', 'genesis_do_cpt_archive_title_description' );
     
    		remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
    		//add_action( 'genesis_after_content', 'genesis_posts_nav' );
     
    	}
    }
     
    //* Helper function to display Post title and Post content/excerpt wrapped in a custom div
    function sk_masonry_title_content() {
    	echo '<div class="title-content">';
    		genesis_do_post_title();
    		genesis_do_post_content();
    	echo '</div>';
    }
     
    //* Helper function to display Post info and Post meta
    function sk_masonry_entry_footer() {
    		genesis_post_info();
    		genesis_post_meta();
    }
     
    //* Set the second parameter to width of your masonry brick (.home .entry, .archive .entry)
    add_image_size( 'masonry-brick-image', 233, 0, TRUE );
     
    //* Helper function to display featured image
    //* Source: http://surefirewebservices.com/development/genesis-framework/using-the-genesis-featured-image
    function sk_masonry_block_post_image() {
    		$img = genesis_get_image( array( 'format' => 'html', 'size' => 'masonry-brick-image', 'attr' => array( 'class' => 'post-image' ) ) );
    		printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $img );
    }
     
    //* Add more link when using excerpts
    function sk_excerpt_more($more) {
        return '<a class="more-link" href="'. get_permalink() . '">&nbsp;&nbsp;[Continue Reading]</a>';
    }
    add_filter('excerpt_more', 'sk_excerpt_more');
     
    //* Modify the length of post excerpts
    add_filter( 'excerpt_length', 'sk_excerpt_length' );
    function sk_excerpt_length( $length ) {
    	return 10; // pull first 10 words
    }
    

    my url is http://www.propertiesnewlaunch.sg/ where you can see the difference between homepage and when you click on all category.

    June 10, 2014 at 7:07 am #108752
    Lauren @ OnceCoupled
    Member

    The content is being called twice on your home page, because of your masonry code and the fact that you're using Genesis Grid Loop.

    This function: remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); does not work with the Genesis Grid Loop, so when you call: genesis_do_post_content(); later, it's being duplicated.

    Try removing that call for the post content, and styling the default content block, or not using the genesis grid loop on your home page.

    Best,
    Lauren


    We create mobile-first, PageSpeed-optimized, pixel-perfect custom themes! https://www.oncecoupled.com

    June 12, 2014 at 2:12 am #109444
    verti
    Member

    I see, thanks for the information, issue solved now

    Regards
    Joe

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble