Category and Posts in front page

First of all don’t require to hesitate your self as beginner in wordpress. Second, for category listing with according posts you need to do something like below: <ul class=”et_pb_tabs_controls clearfix tab-ul”> <?php dynamic_sidebar(‘sidebar’); $cate_id=get_query_var(‘cat’); global $sitepress; $paged = ( get_query_var(‘page’) ) ? get_query_var(‘page’) : 1; $sitepress->switch_lang( $sitepress->get_default_language() ); $args = array( ‘type’ => ‘post’, ‘child_of’ … Read more

How do I display posts ordered by a date custom field?

I figured it out afterwards. Ended up using a different approach, I’m posting it in case someone has the same issue <?php date_default_timezone_set(‘America/Argentina/Buenos_Aires’); $posts_by_date_field = new WP_Query(array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘fecha’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘meta_type’ => ‘DATE’ )); if ($posts_by_date_field->have_posts()) : while ($posts_by_date_field->have_posts()) : $posts_by_date_field->the_post(); // LOOP … Read more

Ajaxify Post Sort

I am by no means an AJAX expert, I have only ever used for pretty much what you are needing it for. It can be quite a lengthy explanation for a forum post. But when I was trying to achieve the same thing the first time, I found this excellent YouTube video series (5 parts) … Read more

wp_query args with relation

I think your query is wrong post__not_in only accepts array of post_id’s only. I think it should be like this. $onemonth_before = date(‘Y-m-d’, strtotime(‘-1 month’)); $args = array( ‘tag__not_in’ => array(<pass tag_id here>), ‘date_query’ => array( ‘before’ = $onemonth_before, ‘inclusive’ = true, ), ); $query = new WP_Query($args);

Display number of post published every day

Since the publish date is stored, you can simply range-select count for posts, which are published in a given interval range. function count_posts_per_interval($seconds) { global $wpdb; $count = (array) $wpdb->get_row($wpdb->prepare( “select count(ID) from wp_posts where post_status=”publish” and post_date between date_sub(now(), interval %d second) and now();”, $seconds )); return (int) array_shift($count); } The SQL query can … Read more