Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ben83

    (@ben83)

    It’s OK for the thumbnail sizes, but how to create two differents sizes of posts ?
    For information, I have no problem with CSS, I am just lost in the PHP 🙂

    I guess I have to create 2 sorts of posts in my loop. I just want to create a very simple grid like that, for example : :
    The first one 100% wide, then 2 posts, then one, then 2, etc.

    Here is my basic loop :

    <?php if (have_posts()): while (have_posts()) : the_post(); ?>
    
    	<!-- article -->
    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    		<!-- post thumbnail -->
    		<?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>
    			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    				<?php the_post_thumbnail(array(120,120)); // Declare pixel size you need inside the array ?>
    			</a>
    		<?php endif; ?>
    		<!-- /post thumbnail -->
    
    		<!-- post title -->
    		<h2>
    			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    		</h2>
    		<!-- /post title -->
    
    		<!-- post details -->
    		<span class="date"><?php the_time('F j, Y'); ?> <?php the_time('g:i a'); ?></span>
    		<span class="author"><?php _e( 'Published by', 'html5blank' ); ?> <?php the_author_posts_link(); ?></span>
    		<span class="comments"><?php if (comments_open( get_the_ID() ) ) comments_popup_link( __( 'Leave your thoughts', 'html5blank' ), __( '1 Comment', 'html5blank' ), __( '% Comments', 'html5blank' )); ?></span>
    		<!-- /post details -->
    
    		<?php html5wp_excerpt('html5wp_index'); // Build your custom callback length in functions.php ?>
    
    		<?php edit_post_link(); ?>
    
    	</article>
    	<!-- /article -->
    
    <?php endwhile; ?>
    
    <?php else: ?>
    
    	<!-- article -->
    	<article>
    		<h2><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h2>
    	</article>
    	<!-- /article -->
    
    <?php endif; ?>

    And I don’t understand how to write a loop getting two sizes of posts, like the example below !

    Thanks a lot for your help, my PHP comprehension is getting better thanks to you.

    Thread Starter ben83

    (@ben83)

    Hi,

    Thank you for your answer.
    In fact, I already have a function for 3 thumbnail sizes in the function.php file.
    But I don’t know how to use them in the loop, to get the first one bigger than the other.

    Thanks a lot for your help,

    Ben

    Thread Starter ben83

    (@ben83)

    Thank you very much, it works !
    Unfortunately, I just notice <?php $postclass = (‘regular’); ?> removes the category class for each post… There is no more category because the post class is like “regular” or “featured”.
    And I used category classes to get style with CSS for each kind of post. (.category-news, videos, etc).
    PHP will kill me.
    Anyway, thanks a lot for your time & help !

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