Weird query with get_posts and WP_Query

I just tried to replicate your code and the only issue I came up with is in one of the arguments to your CPT setup. You have “capability_type” => “comunicado”, But this prevented the CPT working correctly for me. I don’t think this argument should be referring to itself. I replaced it with ‘post’ to … Read more

WordPress pagination returns the same posts

You must change $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; To the following : $paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; There is a difference in page and paged for a static front page, You may find your Answer here : https://developer.wordpress.org/reference/classes/wp_query/#pagination-parameters Keep Posted

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