Janick
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [Active Directory Integration] After update to wordpress 4.3.1 plugin crashedI am having the same error message
Thank you very much! We can see a significant speed improvement!
Forum: Plugins
In reply to: [Magic Fields] [Plugin: Magic Fields] MF2 – Loop not workingThanks, the permalinks were not enable.
After some minor success programming myself I came across the code below.
It adds all custom content types to the loop.https://bajada.net/2010/10/12/custom-post-types-in-the-loop-using-pre_get_posts-refined
function ucc_pre_get_posts_filter( $query ) { global $wp_query; if ( !is_preview() && !is_admin() && !is_singular() && !is_404() ) { if ($query->is_feed) { /* As always, handle your feed post types here. */ } else { $my_post_type = get_query_var( 'post_type' ); if ( empty( $my_post_type ) ) { $args = array( 'public' => true , '_builtin' => false ); $output = 'names'; $operator = 'and'; /* Get all custom post types automatically. */ $post_types = get_post_types( $args , $output , $operator ); /* Or uncomment and edit to explicitly state which post types you want. */ // $post_types = array( 'event' , 'location' ); /* Add 'link' and/or 'page' to array() if you want these included: * array( 'post' , 'link' , 'page' ), etc. */ $post_types = array_merge( $post_types , array( 'post' ) ); $query->set( 'post_type' , $post_types ); } } } return $query; } add_action( 'pre_get_posts' , 'ucc_pre_get_posts_filter' );
Viewing 3 replies - 1 through 3 (of 3 total)