Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter adamrobertson

    (@adamrobertson)

    Thanks for the support guys, great job.

    Thread Starter adamrobertson

    (@adamrobertson)

    Here’s my new code. Everything works as expected except the formatting for the paginated pages is off (I think the 2 featured posts on the first page is throwing the counter off). Any help?

    https://inspirato.hellomynameisad.am/

    <?php
    					global $wp_query;
    
    					$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    					if ( get_query_var('paged') ) {
    
    					    $paged = get_query_var('paged');
    
    					} elseif ( get_query_var('page') ) {
    
    					    $paged = get_query_var('page');
    
    					} else {
    
    					    $paged = 1;
    
    					}
    
    					query_posts(array('posts_per_page' => '5','paged'=>$paged,'category_name'=>'uncategorized')); ?>
    
    					<?php if (have_posts()) : ?>
    					    <?php
    					        /* Custom loop to show n main posts (title + excerpt) then
    					           finish with remainder as small posts (just title) in markup that allows
    					           columns of unequal mini-posts in rows.
    
    					           Here one main post then subsequent mini-posts in rows of 3.
    					           Total number per page defined in WP options
    
    					        */
    					        $count = 0; //start the counter
    					        $main_posts = 2; //set the number of main posts
    					    ?>
    
    					    <?php // find out how many posts so we can close this thing properly at the last post
    					    $totalposts = sizeof($posts); ?>
    
    					    <?php while (have_posts()) : the_post(); ?>
    					    <?php $count++; //increment counter by 1 ?>
    					    <?php $small_posts_count = ($count - $main_posts) ; // calculate the number of small posts ?>
    					      <?php if ( !is_paged() && $count < ($main_posts + 1)) : // if within the range of main post set above then...  ?>
    
    					                <div class="sixcol feature<?php if ((isset($count)) && ($count % 2 == 0 )) { echo ' last';} // same logic to add class of last to last item in row of two ?>" id="post-<?php the_ID(); ?>">
    					                    <article id="post-<?php the_ID(); ?>" role="article">
    
    					                    	<div class="thumb-wrapper mobile">
    					                    	<?php if(has_post_thumbnail()) { $image_src = wp_get_attachment_image_src( get_post_thumbnail_id(),'post-thumb' ); echo '<img src="' . $image_src[0] . '" width="100%" class="post-thumb" />'; } ?>
    
    					                    	    <header class="post-thumb-header">
    					                    		    <h2 class="post-title"><?php the_title(); ?></h2>
    					                    	    </header> <!-- end article header -->
    					                    	    <p class="meta"><?php the_category(', '); ?></p>
    					                    	</div>
    
    					                    	<section class="mobile-content">
    					                    		<?php the_excerpt(); ?>
    					                    	</section>
    
    					                        </article> <!-- end article -->					                </div>
    					        <?php else : // if loop is at small_posts start a wrapper div.loop2 for next row of posts ?>
    					            <?php // if (count-1)/3 is an integer then it's first in the row: open the wrapper
    					                if (($small_posts_count - 1) % 3 == 0 ) { echo '<div class="loop2 clearfix">';} ?>
    					                <div class="fourcol small<?php if ((isset($small_posts_count)) && ($small_posts_count % 3 == 0 )) { echo ' last';} // same logic to add class of last to last item in row of three ?>" id="post-<?php the_ID(); ?>">
    					                    <article id="post-<?php the_ID(); ?>" role="article">
    
    					                    	<div class="thumb-wrapper mobile">
    					                    	<?php if(has_post_thumbnail()) { $image_src = wp_get_attachment_image_src( get_post_thumbnail_id(),'post-thumb' ); echo '<img src="' . $image_src[0] . '" width="100%" class="post-thumb" />'; } ?>
    
    					                    	    <header class="post-thumb-header">
    					                    		    <h2 class="post-title"><?php the_title(); ?></h2>
    					                    	    </header> <!-- end article header -->
    					                    	    <p class="meta"><?php the_category(', '); ?></p>
    					                    	</div>
    
    					                    	<section class="mobile-content">
    					                    		<?php the_excerpt(); ?>
    					                    	</section>
    
    					                        </article> <!-- end article -->
    					                </div>
    					            <?php //close the row if multiple of three (using same logic as above) or if it's the last post
    					                if (($count == $totalposts) || ($small_posts_count % 3 == 0 )) { echo '</div><!-- .loop2 -->';} // if is multiple of three ?>
    
    					      <?php endif; ?>
    
    					        <?php endwhile; ?>
    
    					        						        <nav class="wp-prev-next">
    					        							        <ul class="clearfix">
    					        								        <li class="prev-link"><?php next_posts_link(_e('&laquo; Older Entries', "bonestheme")) ?></li>
    					        								        <li class="next-link"><?php previous_posts_link(_e('Newer Entries &raquo;', "bonestheme")) ?></li>
    					        							        </ul>
    					        					    	    </nav>
    
    					    <?php endif; ?>
    Thread Starter adamrobertson

    (@adamrobertson)

    Got the issue of pagination working on the live version fixed. All I’m left with is the formatting not working correctly on paginated pages:

    https://inspirato.hellomynameisad.am/

    Thread Starter adamrobertson

    (@adamrobertson)

    Thanks. I added this but not the posts on the paginated pages are messed up. Furthermore, pagination works fine on my local (although the formatting is still off) but pagination isn’t working on the live version:

    https://inspirato.hellomynameisad.am/

    Any ideas? Thanks so much.

    Thread Starter adamrobertson

    (@adamrobertson)

    Thanks!

    Thread Starter adamrobertson

    (@adamrobertson)

    After some research, I found this:

    < ?php if (is_tag()) { ?>
    <link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(‘template_url’); ?>/style1.css” />
    < ?php } else {?>
    <link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(‘template_url’); ?>/style.css” />
    < ?php } ?>

    Will that do the trick?

Viewing 6 replies - 1 through 6 (of 6 total)