how to exclude “featured” posts from the main loop?

This would be an appropriate use of query_posts(), with a post custom meta query. Since you’re querying by meta_key=featured_article&meta_value=on, you would then exclude on the same parameters. <?php // Setup the custom meta-query args $exclude_featured_args = array( ‘meta_query’ => array( array( ‘key’ => ‘featured_article’, ‘value’ => ‘on’, ‘compare’ => ‘!=’ ) ) ); // globalize … Read more

How to add pagination to my code?

Add this to functions.php: // Pagination function pagination($pages=””, $range = 4) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == ”) { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo “<div class=\”pagination\”><span>Page “.$paged.” of “.$pages.”</span>”; if($paged > 2 && $paged > … Read more

Hide featured post on second page

In short no – the template used is based on the query, and when paginating you are essentially repeating the same query, but for a different page. In general the template will be the same. archive.php can be used for most queries, but often preferable templates exist (e.g. category templates, tag templates, author templates etc.). … Read more

Get the 5 lastest Featured Posts from a category

<?php /* Set the name of the category and the number os posts to be displayed */?> <?php $first_query = new WP_Query(‘category_name=name&posts_per_page=7’); ?> <?php /* Show the posts */ ?> <?php while ($first_query->have_posts()) : $first_query->the_post(); ?> <?php /* Make the hiperlink to the post */ ?> <a href=”https://wordpress.stackexchange.com/questions/59934/<?php the_permalink(); ?>”> <?php /* Get the featured … Read more

Adding a ‘featured’ class to certain posts

WordPress by default provides such feature named “Sticky Posts”. you can mark any post as sticky from “Quick Edit” link. and WordPress will add a post class named sticky with all sticky posts. so you can use this class in your CSS for giving custom styles. and another solutions is to create custom post meta … Read more

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