custom post type index page

If you have: register_post_type( ‘my_custom_post_type’, $args ); And you need a custom page to displays all entries from this custom post type, you have to create: archive-my_custom_post_type.php. But if you don’t need a custom page, wordpress will use archive.php to display you custom post type archive. If you only need to customize the entry page, … Read more

attach one post from one post type to another post from another post type

Plugin Recommendations are considered off-topic here. One solution could be to add a metabox to your post like so: Add to Functions.php /** Add Post Metabox **/ function add_custom_meta_box() { add_meta_box( ‘pick_post’, // $id ‘Pick Post’, // $title ‘show_custom_meta_box_pick_post’, // $callback ‘agenda’, // $page ‘side’, // $context ‘high’); // $priority } add_action(‘add_meta_boxes’, ‘add_custom_meta_box’); /** Post … Read more

Query current and future events, ordered by begin date

This happens because of the OR relation on meta_query and the way WordPress generates the actual query string. You need to leave out the meta_key and orderby from the query args and hook into the posts_clauses filter to modify the where and orderby pieces of the query: function wpse_130954_orderby_fix($pieces){ global $wpdb; $pieces[‘where’] .= ” AND … Read more

Make Custom Post Behave Like Normal Post?

The reason its messing up is because its adding the custom post type everywhere. You want to limit it to just the main loop of the main page. Justin Tadlock wrote an article on how to do that here. Here is what your code should look like: add_filter( ‘pre_get_posts’, ‘my_get_posts’ ); function my_get_posts( $query ) … Read more

Dynamically create/remove terms in taxonomy when custom post type is published/trashed

Ok, I think I’ve figured out a viable solution. Kinda disappointed that there’s no way I’ve found thus far to hook directly into trash_{custom_post_type} like I was able to on the publish_{custom_post_type} hook. Here’s a solution for anyone else struggling with this issue. If anyone has any better suggestions, please feel free to share! /** … Read more