Tag Info

New answers tagged

0

Never mind I got it. I used <?php the_ID(); ?> to set unique id's but even so that was not the problem. Turns out the first accordion had a class of "in" so the real question was How can I only give a class to the first post of a loop? and I did that by using a simple counter. <?php $c = 0; ?> increment it at the end of the loop then give a ...


0

Try The code below. In your code, the collapseOne was repeated throughout the loop. I added $i as counter and set it as id and href link <?php get_header(); ?> <?php $args = array( 'post_type' => 'question' ); $the_query = new WP_Query( $args ); ?> <div class="wrap"> <div ...


0

You can add custom class to post thumbnails. the_post_thumbnail accepts array of attribute $attr where you can specify image class. So your code will be. <div class="home-featured-img"> <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail( 'full', array( 'class' ...


1

The second argument of the_post_thumbnail is $attr, which you can add classes to. One note is that you will be overriding the default classes, so you will need to add them in as well. The default is attachment-$size, which is why I added attachment-post-thumbnail in my example. the_post_thumbnail( 'post-thumbnail', array( 'class' => ...



Top 50 recent answers are included