Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter laemo

    (@laemo)

    Anyone? Isn’t there a way to style today’s posts differently from those of other days? I mean come on please help!

    Thread Starter laemo

    (@laemo)

    Any help would be appreciated. Please help!

    Thread Starter laemo

    (@laemo)

    Bump. Please help!

    Thread Starter laemo

    (@laemo)

    Thread Starter laemo

    (@laemo)

    Okay, thanks again. Starting a new thread. ??

    Thread Starter laemo

    (@laemo)

    t31os_, if I can bother you with just one idea. Is it possible to run the loop to show posts from say a particular date in full (most recent day) and style the rest of them differently?

    I’d like to show just today’s posts in full and the rest in a list. I know I have already bothered you enough, and I have done a bit of searching but cannot seem to find any success.

    Thread Starter laemo

    (@laemo)

    That worked like a charm. Thank you so much ??

    I really really appreciate all the help you’ve provided.

    Thread Starter laemo

    (@laemo)

    Believe it or not t31os_, it executed the code, showed me the same post on the entire page for some reason.

    It showed the entire post 5 times first, and then 19439 times again showing just the title (I kid you not!) before throwing this error:
    Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\wordpress\wp-includes\post.php on line 812

    I tried it both on my local as well as the actual server to confirm this.

    I have updated the pastebin with the code I’ve used:

    https://wordpress.pastebin.ca/1804858

    Really appreciate your help till here. Logically what you did makes sense, but for some reason it keeps showing just 1 post on the entire page.

    Thread Starter laemo

    (@laemo)

    Yes, that’s correct.
    What I am trying to accomplish is show the first 5 posts with images and excerpt (controlled via a plugin), and just the headline of the next 15.

    Thanks, I really do appreciate you helping out.

    Thread Starter laemo

    (@laemo)

    I’d very much appreciate that, thanks ??

    I did speak to a friend who said I can just use one loop and instead of breaking enter the code there, I could definitely use some examples.

    Thread Starter laemo

    (@laemo)

    The reason I asked for help was because I wasn’t able to figure it out. That’s the reason why they have the support forums, right?

    Anyway, thanks for trying to help.

    Thread Starter laemo

    (@laemo)

    Here is the problem:

    Using the code above.. it shows me 5 posts in full

    Post 1
    Post 2
    Post 3
    Post 4
    Post 5

    Now, the second loop, without offset shows me the titles of the posts:

    Title 1
    Title 2
    ..
    Title 15

    There is duplication of first 5 titles as the same posts are displayed using the first loop.

    If I USE the offset option, the first page displays correctly (excludes the 5 posts displayed on top). However, on other pages, it shows the exact same posts as shown on the first page.

    Any thoughts how I could fix it? The second loop has to exclude the first 5 posts displayed on that particular page.

    Thread Starter laemo

    (@laemo)

    Updated, okay I was able to get the first loop working by using the following code:

    <?php get_header(); ?>
    <?php global $query_string; ?>
    	<div id="main" class="clearfix">
    		<div id="posts" class="grid_8">
    			<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    			<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    			<?php query_posts($query_string.'&showposts=5&paged='.$paged); ?>
    			<?php $posts = get_posts($query_string.'&showposts=5&paged='.$paged); foreach ($posts as $post) : start_wp(); ?>
    			<?php static $count1 = 0; if ($count1 == "5") { break; } else { ?>
    
    			<div class="post">
    				<div class="post-image">
    					<?php if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) : ?>
    						<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'large', false, '' ); ?>
    						<img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo $src[0]; ?>&w=576&h=172&zc=1" border="0" alt="<?php the_title(); ?>" />
    					<?php else : ?>
    						<?php if( get_post_meta( $post->ID, "image", true ) ) : ?>
    							<img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image", true ); ?>&w=576&h=172&zc=1" border="0" alt="<?php the_title(); ?>" />
    						<?php else : ?>
    							<img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo wp_catch_first_image('l'); ?>&w=576&h=172&zc=1" border="0" alt="<?php the_title(); ?>" />
    						<?php endif; ?>
    					<?php endif; ?>
    				</div>
    				<h1 class="post-title"><a href="<?php the_permalink(); ?>" title="Continue reading &quot;<?php the_title(); ?>&quot;"><?php the_title(); ?></a></h1>
    				<div class="post-meta clearfix">
    					<span class="datetime"><?php the_time('F jS, Y') ?></span>
    					<span class="category"><?php the_category(', ') ?></span>
    					<span class="comment"><?php comments_number('No Comment','1 Comment','% Comments'); ?></span>
    				</div>
    				<div class="post-excerpt"><?php wp_limit_post(200,'.'); ?></div>
    				<span class="post-link"><a href="<?php the_permalink(); ?>" title="Read more about &quot;<?php the_title(); ?>&quot;">Read more &raquo;</a></span>
    			</div>
    
    			<?php $count1++; } ?>
    			<?php endforeach; ?>
    
    			<?php endwhile; endif; ?>
    
    			<div class="post-small">
    			<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    			<?php query_posts($query_string.'&showposts=15&paged='.$paged); ?>
    			<?php $posts = get_posts($query_string.'&showposts=15&paged='.$paged.'&offset=5'); foreach ($posts as $post) : start_wp(); ?>
    			<?php static $count2 = 0; if ($count2 == "15") { break; } else { ?>
    
    			<?php the_date('', '<br />', '<hr />'); ?>
    
    				<h1 class="post-title-small"><a href="<?php the_permalink(); ?>" title="Continue reading &quot;<?php the_title(); ?>&quot;"><?php the_title(); ?></a></h1>
    				<div class="post-meta clearfix">
    					<span class="datetime"><?php if(!function_exists('how_long_ago')){the_time('F jS, Y'); } else { echo how_long_ago(get_the_time('U')); } ?>
    </span>
    					<span class="category"><?php the_category(', ') ?></span>
    					<span class="comment"><?php comments_number('No Comment','1 Comment','% Comments'); ?></span>
    				</div>
    
    			<?php $count2++; } ?>
    			<?php endforeach; ?>
    		</div>
    			<?php endwhile; endif; ?>
    
    			<div class="post-navigation clearfix"><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>
    		</div>
    		<div id="sidebar" class="grid_4">
    			<?php get_sidebar(); ?>
    		</div>
    	</div>
    <?php get_footer(); ?>

    However, no matter what I try, the second loop isn’t paging correctly. If i remove the offset option, then it pages correctly, however there is duplication of posts. How do I avoid this?

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