Add specific class to featured posts

I hope that “featured” will be a custom field of posts. In that case you can check the value of field using: $desc = get_post_meta($post->ID, ‘featured’, true); You can use if-else condition and check that if you get value=1 {or what you assigned for featured} then apply class”hot”. Give it a try. best of luck

how to place Post and page content side by side

I am suggesting you to use two for loop using two post types. For blog post use below code <?php query_posts( array( ‘post_type’ => array( ‘post’) ‘showposts’ => 5 ) ); ?> <?php while ( have_posts() ) : the_post(); ?> <div class=”post_type”> <a href=”https://wordpress.stackexchange.com/questions/203262/<?php the_permalink(); ?>”><?php the_title(); ?></a> <div class=”excerpt”> <?php echo get_the_excerpt(); ?> </div> … Read more

Foreach loop inside foreach loop?

Your 2nd foreach loop is a bug. $slug is a string with a single value, and you cannot pass a string to a foreach loop. If you set debug to true, you will see an error message telling you just this. You can simply just do //Different markers for different types $car_type = get_the_terms( $post->ID, … Read more

Add row after three columns

Here’s an idea of what I think you could do if I understand the problem correctly: <div id=”primary” class=”content-area”> <main id=”main” class=”site-main” role=”main”> <div class=” entry-content”> <?php if ( have_posts() ) { $post = $posts[0]; $c = 0; $i = 0; while ( have_posts() ) { the_post(); // start a new row for the first … Read more

Configure query with multiple categories in a custom order?

I am hoping that I understood your question, because recently I found myself needed to dynamically include a list of child categories and their count in a hierarchy menu in a post and so I came up with this: I put this in file called listcat.php <?php /* Plugin Name: List Categories Reference: http://codex.wordpress.org/Template_Tags/wp_list_categories Description: … Read more

Custom Looping of WordPress Posts

Hi I believe this should work <div class=”col-xs-8″> <?php $count = 1; ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php if $count = 1; ?> <!– First post Wrapper–> <div class=”first-post”> <article class=”post1″></article> </div> <!– Rest all post Wrapper–> <div class=”all-posts”> <?php else : ?> <article class=”post<?php echo … Read more