Portfolio problem

Homepage Community Forums Epik Theme Support Portfolio problem

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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?

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

        #8092
        Anup
        Customer

          Thanks, that worked.

          #8096
          Wes
          Moderator

            You’re Welcome!

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