Nata I
asked 8 years ago

Hi! I like this theme very much and use the previous version at valvetimes.com. And we have the first post grid-doubled by adding class grid-double to the post’s class (without custom fields). How can I do the same in the actual version? 

2 Answers
Nata I
answered 8 years ago

Well, ok, the same way.
Just need to incert content.php into home.php and edit home.php like this

<div id=”content” class=”masonry”>
<?php $i=0; ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php $i++ ?>
<?php
if ($i==1): $cls=’class=” ‘. implode(‘ ‘,get_post_class()).’ grid-double “‘;
else : $cls=’class=” ‘. implode(‘ ‘,get_post_class()).’ “‘;
endif;
?>
<div id=”item-<?php the_ID(); ?>” <?php echo $cls ?> >
<div class=”item-inner”>
<?php if( has_post_format(‘gallery’) ) : ?>

DominicStaff
answered 8 years ago

Hi Nata !
I think you have resolve the issue. I appreciate it !

marcgernmain
replied 7 years ago

How did you resolve it …

dominic Staff
replied 7 years ago

To make the fist post to be auto call "double", you can add the following code to the function.php file:

add_filter( 'post_class', 'wps_first_post_class' );
function wps_first_post_class( $classes ) {
    global $wp_query;
    if( 0 == $wp_query->current_post )
        $classes[] = 'grid-double';
        return $classes;
}

Hope this helps !

Powered by DW Question & Answer Pro