Output 2 items within the Loop

Easy using WP query (get to know it…) <ul> <?php $recentPosts = new WP_Query(); $recentPosts->query(‘showposts=2’); // SET AMOUNT HERE ?> <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?> <li><div class=”slide”><?php the_content(); ?></div></li> <?php endwhile; ?> </ul> Hope this helps. Let me know if you encounter any issuse. EDIT 1: * explenation – just added a small conditional … Read more

Need help with else if statement

You should familiarize yourself with PHP, but if you want a default color ( assuming the code below already works ) you could do: <?php if ( in_category( ‘News’ )) : ?> <div class=”green”> <?php elseif ( in_category(‘Blog’)) : ?> <div class=”orange”> <?php else : ?> <div class=”pink”> <?php endif; ?>

Post tags show outside loop?

The code is tested and working fine. Place this code <?php $posttags = get_the_tags(); if( ! empty( $posttags ) ) : $tags = array(); foreach($posttags as $key => $value){ $tags[] = $value->name; } ?> <meta name=”keywords” content=”<?php echo implode( ‘,’, $tags ); ?>,test”/> <?php endif;?> instead of <meta name=”keywords” content=”<?php the_tags( ”, ‘,’, ” );?>test<?php … Read more

is_home() in HTML head

both is_home() and is_front_page() works in the header or anywhwere you are using a theme template. Most likely, the problem is because you’ve hardcoded this: /wordpress/wp-content/themes/roots/style.php Try instead creating your url like this: <link rel=”stylesheet” type=”text/css” media=”all” href=”https://wordpress.stackexchange.com/questions/85053/<?php echo get_stylesheet_directory_uri(); ?>/style.php?tcount=<?php echo $count;?>” />

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