what custom post type this archive belongs to?
The aptly named is_post_type_archive() seems to be what you need, or perhaps that plus is_archive() depending on exactly what you are trying to do.
The aptly named is_post_type_archive() seems to be what you need, or perhaps that plus is_archive() depending on exactly what you are trying to do.
You are using the_post_thumbnail() which will echo the actual thumbnail. You should use get_the_post_thumbnail() if you want the value to be returned, not echoed. So, change: $slide_img = the_post_thumbnail(); To: $slide_img = get_the_post_thumbnail(); You should also, as Matt points out, make sure you are using the correct meta field names and check if the values … Read more
WordPress had a built-in conditional tag for that: if ( is_page_template( ‘page-courses.php’ ) ) { include_once(‘functions_courses.php’); }; More infos on the codex
Why not just turn off the default tags capability then register a tags taxonomy specific to the custom post type? http://codex.wordpress.org/Function_Reference/register_taxonomy register_taxonomy( ‘my_custom_post_type_tags’, ‘my_custom_post_type’, array( ‘label’ => __( ‘Tags’ ), ‘rewrite’ => false, ‘hierarchical’ => false, ‘capabilities’ => array( ‘edit_terms’ => ‘manage_categories’ ) ) );
This is very easy with post types generated by Pods. If you create a Custom Post Type with Pods, you can add this to Parent Menu ID: “edit.php?post_type=top_level_post_type”
Check if a user is logged in using is_logged_in. If a user is logged in modify the query using pre_get_posts filtering posts by the current author ID. if ( is_user_logged_in() ) : function filter_posts_by_author( $query ) { global $current_user; get_currentuserinfo(); $query->set( ‘author’, $current_user->ID ); } add_action( ‘pre_get_posts’, ‘filter_posts_by_author’ ); // … loop else : echo … Read more
My initial code did not provide default WP_query argument parameters if either Select option was not set – the empty Parameter would filter everything out. To the best of my ability, I applied default parameter values from the initial Post and Terms queries and now the select filter is working. I would be pleased to … Read more
You have to use array like this: array( ‘post_type’ =>’news’, ‘category_name’ => $category, //use category slug (NOT name). ‘post__not_in’=> array($post->ID) ); For more reference please visit this link
Between my phone and work some errors creeped in, sorry about that. here is my revised answer. Hope this helps in solving your problem. PROBLEM 1 You should not name your template ‘archive-{$post_type}.php’ if it is a page template. This totally goes against the template hierarchy for pages, and that is why your static frontpage … Read more
There is no concept of an archive of terms in WordPress. Archives are collections of posts, The Loop only outputs posts. If you want a page listing all terms in a taxonomy, create a page, assign it a custom page template, and output the taxonomy’s terms via one of the API functions, like get_terms.