Comment moderation on custom post types

Yes, this is possible. Comment moderation is an option, and is retrieved like any other option: get_option(‘comment_moderation’); the get_option function applies a filter before returning the value… return apply_filters( ‘option_’ . $option, maybe_unserialize( $value ) ); So what you’ll want to do is add_filter(‘option_comment_moderation’, ‘check_moderable_post_types’) and in your check_moderable_post_types function, check to see if the … Read more

Custom post type archive sorted and grouped by date in post meta field

OK, so this problem has two parts: Make WordPress to sort these posts properly. Make WordPress to display them with all that grouping. 1. Sorting CPT by meta value on archive You can use pre_get_posts to achieve this. add_action( ‘pre_get_posts’, function ( $query ) { if ( is_post_type_archive( ‘event’ ) && $query->is_main_query() ) { $query->set( … Read more

Custom Post Types Not acknowledged for date.php template

Date archives default to querying just the post post type, you can add additional post types to those queries via the pre_get_posts action function wpa_date_archive_post_types( $query ){ if( $query->is_main_query() && $query->is_date() ): $query->set( ‘post_type’, array( ‘post’, ‘your_custom_type’ ) ); endif; } add_action( ‘pre_get_posts’, ‘wpa_date_archive_post_types’ );

get a list of posts from Custom Taxonomy

Check out the Taxonomy Parameters. <?php $args = array( ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘taxonomy_name’, ‘field’ => ‘id’, ‘terms’ => ’22’ ) ) ); $the_query = new WP_Query( $args ); while ( $the_query->have_posts() ) : $the_query->the_post(); //content endwhile; ?>