meta_value timestamp older than now

<?php $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘event’, ‘meta_query’ => array( array( ‘key’ => ‘event_date_end_timestamp’, ‘value’ => time(), ‘type’ => ‘numeric’, ‘compare’ => ‘<‘ ) ) ); $programs = new WP_Query($args); ?> <?php while($programs->have_posts()): $programs->the_post(); ?> <h1><?php the_title(); ?></h1> <?php endwhile; ?>

add bootstrap post slider with tabs

There’s probably some better way of doing this, but thought i’d give it a go anyways 🙂 – also got some of the answer from here Adding active class to first item <div class=”container”> <div id=”myCarousel” class=”carousel slide” data-ride=”carousel”> <!– Wrapper for slides –> <div class=”carousel-inner”> <?php $c = 0; $class=””; $args = array( ‘posts_per_page’ … Read more

Assign published posts to another user automatically

You can try using wp_insert_post_data for the task. Something like: function assign_new_post_to_specific_author( $data , $postarr ) { // Where author_ID is the ID of the author you want to assign the new post $data[‘post_author’] = author_ID; return $data; } add_filter( ‘wp_insert_post_data’, ‘assign_new_post_to_specific_author’, ’99’, 2 ); Tried it on c9.io and it works, but you need … Read more

Show posts by author of membership level (Paid Membership Pro)

$ids = get_users( array(‘role’ => ‘author’ ,’fields’ => ‘ID’) ); $contr_limit = count($ids); for($cntr=0; $cntr < $contr_limit; $cntr++){ if( pmpro_hasMembershipLevel($level_id, $ids[$cntr] ) !== true ){ unset($ids[$cntr]); } } $args = array( ‘author’ => implode(‘,’, $ids), ‘orderby’ => ‘date’, ‘order’ => ‘ASC’, );

How do you change the comment count in the back end posts list, to reflect unapproved comments, rather than all comments?

Add following code in your theme’s functions.php. // To add extra column in column headers add_filter(‘manage_posts_columns’, ‘bs_event_table_head’); function bs_event_table_head( $defaults ) { $defaults[‘pending_comments’] = ‘Pending Comments’; return $defaults; } // To add data in column for each post. add_action( ‘manage_posts_custom_column’, ‘bs_event_table_content’, 10, 2 ); function bs_event_table_content( $column_name, $post_id ) { if ($column_name == ‘pending_comments’) { … Read more

Display author’s name and avatar in post’s sidebar

Display author’s avatar and name in single page sidebar. Add this code in sidebar.php or single.php if ( is_singular( ‘post’ ) ) { echo get_avatar( get_the_author_meta( ‘user_email’ ), 75 ); echo get_the_author_meta( ‘display_name’ ); } Here 75 number is the avatar size. I hope it will help you.

Posts – display all posts except a post by an ID

Couple of issues here IIRC, exclude should be an array of ID’s as exclude get passed to WP_Query as post_not_in You are defining arguments which you don’t use. You could have simply passed that to get_posts. Rememeber, all parameters in WP_Query is available as is to get_posts as get_posts uses WP_Query You can simply use … Read more