294 Queries on Mainpage of WordPress

This query will get all the countries and counts in one query: global $wpdb; $countries_count = $wpdb->get_results( ” SELECT meta_value AS country, COUNT(post_id) AS count FROM {$wpdb->postmeta} WHERE meta_key = ‘tgt_job_country’ GROUP BY country ORDER BY country” ); foreach ($countries_count as $country) echo “<li><a href=”http://dsdjjhfgd.net/s=jobseeker&usertype=jobseeker&country=”.$country->country.”&search=Search”>”.$country->country.”(“.$country->count.”)</a></li>”; Unless you need to get the country list first – … Read more

How to exclude certain portfolios from a loop

so I am thinking your $arg would be: $args = array( ‘numberposts’ => $portfolio_items, ‘order’ => $portfolio_sort, ‘orderby’ => ‘date’, ‘post_type’ => array(‘portfolios’), ‘offset’ => $offset, ‘exclude’ => ‘1,2’, ); And that would exclude post 1 and 2. But a better option that you should do, is to just create a featured category for your … Read more

Fix incorrect related posts code snippet

Your first problem: Try to write down what you want to do: You do not want to print posts that are already printed. So you have to remember what posts are already printed. In PHP normally an array is a good solution to remember things that are already done. Let’s add an array: $printed_posts = … Read more

List posts related to category on a div [closed]

Here is a start. Create a template called content-related.php Inside that paste the following code <?php /** * The default template for displaying realted posts * * @package WordPress * @subpackage Pieter Goosen * @since pietergoosen 1.0 */ wp_reset_postdata(); global $post; // Define shared post arguments $categories = get_the_category($post->ID); if ($categories) : $category_ids = array(); … Read more

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