Articles of custom post types

Custom Post Type, Saving Multiple Checkboxes

For a custom post type, I’m pulling in a list of another custom post types that I need to select for saving … <input type=”checkbox” name=”32″> My CPT <br> <input type=”checkbox” name=”41″> My CPT 2 <br> <input type=”checkbox” name=”42″> My CPT 3 <br> <input type=”checkbox” name=”43″> My CPT 4 It’s easy enough to save a […]

How to add a Custom Meta Box for more than one Post Type?

I am using the following code in functions.php for adding a custom meta box. The custom post type is themes. I want to add more post types, how can I? add_meta_box( ‘my-meta-box-id’, ‘Demo & Download’, ‘cd_meta_box_cb’, ‘themes’, ‘normal’, ‘high’ );

if custom posts type exists and there are posts load script

I have registered a custom post type ‘featured_post’. I am looking for a way to test if the blog home page has any ‘featured_post’ posts on it and if it has load a javascript file. The ‘featured_post’ posts will make a slider at the top of the blog home page. I had this working using […]

Change labels of custom post type via child theme

I have a WordPress parent theme that uses a custom post type called portfolio, which I’d like to change to property. I’d like to have all of the contextual elements changed to show property like, “show properties”, “add new property”, “delete property”, etc. I know I can do this by updating the parent theme, but […]

WordPress theme options vs custom post types

For dynamic content across a WordPress website, is it a better practice to create new post types for updating content or using theme options? I personally find theme options a little more time consuming to code than registering a new post type in functions.php

Should i delete the posts created by a plugin on uninstall?

I created a plugin which is based on a Custom Post Type. When someone uninstalls this plugin, should i delete the posts under this post type or i should just leave them untouched?

Custom Post-to-Post with multiple parents?

I currently have a custom post type of “Faculty” – each faculty can have zero or many custom post type “Bibliographies,” and a bibliography can belong to one or more faculty. What is the best practice for setting up this association, and more importantly, is this possible still using the API? I’m testing this with […]

Display custom post type in template

I have a custom post type called campsites, events and activities I want to display this in a list. So when the user click on the link, it will then display all the posts under that custom post type. Any help would be greatly appreciated. Edit add_action(‘init’, ‘activity_resources_register_post_type’); function activity_resources_register_post_type() { register_post_type(‘activity_resources’, array( ‘labels’ => […]

previous_post_link() and next_post_link() with a custom post type?

I’m on single-work.php for a custom post type called work, inside the loop. Trying to make two links to the previous and next post. Using this code: <?php previous_post_link(); ?> and <?php next_post_link(); ?> But nothing shows up. Am I missing something Here is my code, very straightforward: <?php get_header(); ?> <div class=”full” > <?php […]

Get categories for a specific post – Custom post type

I’m trying to retrieve all the categories which are related to a specific post, using the wp_get_post_categories() function. The problem is that it is a custom post type, so I tried sending it in the $args array : wp_get_post_categories($id,array(‘post_type’=>’product’)); but that returned an empty array as well. What is the correct way of doing it?