• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Appfinite

Appfinite

Premium WordPress Themes for The Genesis Framework

  • Themes
  • Blog
  • Tutorials and Resources
  • Forums
  • Contact Us

Portfolio problem

Home › Community Forums › Epik Theme Support › Portfolio problem

  • This topic has 3 replies, 2 voices, and was last updated 9 years, 5 months ago by Wes.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • October 12, 2013 at 12:34 pm #8090
    Anup
    Customer

    http://farmonplate.com/recipes/

    I haven’t changed any code or anything and am not sure why my page is all scattered. Any pointers please?

    October 12, 2013 at 12:42 pm #8091
    Wes
    Moderator

    This will be fixed in the new update 1.3.1

    Basically there needs to be a div that “clears” everything after the 4th post, so that the 5th post starts on a new line in front (towards the left). Without it, it shows up next to the last post with the most height. The code in the portfolio file to add “clear: both” worked with Genesis before, but when the Genesis 2.0 update was released we had to come up with a new way.

    To fix it, look for this in your page_portfolio.php file –

    // Clear float using genesis_custom_loop() $loop_counter variable
    // Outputs clearing div after every 4 posts
    // $loop_counter is incremented after this function is run
    add_action( 'genesis_after_post', 'portfolio_after_post' );
    function portfolio_after_post() {
        global $loop_counter;
        
        if ( $loop_counter == 3 ) {
            $loop_counter = -1;
            echo '<div class="clear"></div>';
        }
    }

    Then replace that code with this –

    // Outputs clearing div after every 4 posts
    add_action( 'genesis_after_entry', 'portfolio_after_post' );
    function portfolio_after_post() {
        
    	global $wp_query;
        
        // Assumes 4 posts per row
    	$end_row = ( $wp_query->current_post + 1 ) / 4;
            
    	if ( ctype_digit( (string) $end_row ) ) {
    		echo '<div class="clear"></div>';	
    	}
    }

    Then you’ll need to add .clear to your css like this –

    .clear {
    	clear: both;
    }

    That should fix it.

    October 12, 2013 at 12:50 pm #8092
    Anup
    Customer

    Thanks, that worked.

    October 12, 2013 at 12:59 pm #8096
    Wes
    Moderator

    You’re Welcome!

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Portfolio problem’ is closed to new replies.

Primary Sidebar

Search Forums

Affiliate Program

Looking to earn some money? Join our Affiliate program and earn 35% of every sale you refer. Top referrers earn 40-50%.

Join Now →

The Genesis Framework

All of our themes are designed for the Genesis Framework. You will need to purchase Genesis in order to use any of our themes.

Purchase Genesis

Hire a Web Developer

Need help setting up or customizing your website?

Contact Us →

Search Full Site

  • Buy Genesis!
  • Shopping Cart
  • Themes
  • My Account
  • Support Forums
  • Tutorials and Resources
  • Privacy Policy
  • Contact Us
  • Follow Us on Twitter

Copyright © 2023 · Appfinite · Built With The Genesis Framework