• 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

Masonry is not showing all posts for a 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 › Masonry is not showing all posts for a category

This topic is: resolved

Tagged: masonry

  • This topic has 4 replies, 2 voices, and was last updated 8 years, 3 months ago by yashitamittal11.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • July 31, 2017 at 1:35 am #209740
    yashitamittal11
    Member

    Hello

    1. I am using Masonry layout to display posts on the page Products belonging to the category Company.

    But only 6 posts are getting displayed on the page. There are close to 14-15 posts belonging to this category.
    Here is the code to output masonry layout:

    
    /** Replace the standard loop with our custom loop */
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    // Add our custom loop
    add_action( 'genesis_loop', 'mgtools_masonry_layout' );
    
    function mgtools_masonry_layout() {
        global $paged; // current paginated page
        $args = array(
        'category_name' => 'company', // category slug
        'order'         => 'ASC',
        'paged'         => $paged, 
        );
        $loop = new WP_Query( $args );
        if( $loop->have_posts() ) {
            echo '<h1>featured <span class="styleProduct">Products</span></h1>';
            echo '<div class="row masonry">';
        
        // loop through posts
        while( $loop->have_posts() ): $loop->the_post();            
            echo '<div class="ms-item">';
            if (has_post_thumbnail()) : 
               echo '<figure class="article-preview-image">';
               the_post_thumbnail('large');    
               echo '</figure>';
            endif; 
         
            echo '<h2 class="post-title"><a href="<?php the_permalink(); ?>" class="post-title-link"><?php get_the_title(); ?></a></h2>';
            //the_excerpt();    
            echo '<div class="clearfix"></div>';
            echo '</div>';// ms-item    
         endwhile;
         echo '</div>';//masonry div
        }//if loop
              
        echo '<div class="clearfix"></div>';
        wp_reset_postdata();
    }
    

    2. I am using get_the_title(); function in the code above to display post title beneath the featured post. But somehow title is not displaying. When I go and check in the Inspect window, get_the_title(); is commented.

    Please advice

    http://greeninvites.com/product/
    July 31, 2017 at 4:58 am #209748
    Victor Font
    Moderator

    This question has nothing to do with the Genesis Framework or your child theme. You are limiting yourself by the number of "Blog pages show at most" you have setup in the WordPress/Reading menu. If you want all posts to show for this query add $posts_per_page => -1 to the $args array.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    July 31, 2017 at 11:33 pm #209801
    yashitamittal11
    Member

    Thanks,

    I have added posts_per_page => -1 to the $args array. It is now showing all the posts.

    There is one more issue that I am facing.

    I am using get_the_title(); function in the code above to display post title beneath the featured post in the masonry. But somehow title is not displaying. When I go and check in the Inspect window, get_the_title(); is commented.

    Please advice.

    August 2, 2017 at 1:03 am #209881
    yashitamittal11
    Member

    Hello,

    The problem with the post title not displaying has been fixed. There was issue in the markup.

    Now I have another problem in the masonry on Products page.
    The last masonry item in the first column is spilling to 2nd column. The post title 'YG1 Tools' is at the beginning of 2nd column.
    I am having hard time fixing this.

    What changes I need to make to fix this.

    August 7, 2017 at 10:21 pm #210102
    yashitamittal11
    Member

    There was extra margin under each masonry item which was causing the issue.
    Removing that solved the issue

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 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

© 2025 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