Apply a style for 4 blogs and another style for the next 4 blogs in wordpress blog page?

In the following code you could add a class specifically based on the position in the loop: <?php /* Start the Loop */ $i = 1; $class=”first-class”; while ( have_posts() ) : the_post(); if($i % 4 == 0){ $class=”second-class-“.+$i; } echo ‘<div class=”‘.$class.'”>’ get_template_part( ‘template-parts/content’, get_post_format() ); echo ‘</div>’ $i++; endwhile; ?> This is essentially … Read more

Show the page title on blog page

The call for the page title is outside the loop so you need to use this function instead: <?php echo get_the_title(); ?> Here is the updated code: <?php get_header(); ?> <section id=”primary-content” class=”col-md-9″> <?php echo get_the_title(); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class=”post”> <h2><a href=”https://wordpress.stackexchange.com/questions/146051/<?php the_permalink(); … Read more

How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts

Or is it because im trying to add it to the css class .has-post-thumbnail which is applied to all posts? Yes, set_featured_background() gets first post from the loop and add .has-post-thumbnail to styles. All posts that have thumbnail (with class .has-post-thumbnail) will have the same background. Try setting the background in the template file responsible … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)