Articles of custom post types

How to create new category for custom post type?

I have create a custom post type named “jobs”, and I want to create a set of category for that, ie like “PHP Jobs”, “Python Jobs” etc. $args = array( ‘labels’ => $labels, ‘public’ => true, ‘publicly_queryable’ => true, ‘show_ui’ => true, ‘show_in_menu’ => true, ‘query_var’ => true, ‘rewrite’ => true, ‘capability_type’ => ‘post’, ‘exclude_from_search’ […]

Custom post types columns strange issue

I have 4 custom post types in my theme. When I add a description column (the_excerpt) for them I get some really strange behavior. The description column repeats 4 times on each post on every custom post type. Also get a PHP notice that I can’t get rid of. Like this: Notice: Trying to get […]

How to: Display ACF on Custom Post Types Utilising WordPress 'Hooks'?

Sub-questions: i) Which files/templates need to be copied to the child theme folder, other than function.php and style.css? ii) What actions/filters/ should be used and where should this code be inserted? Apologies, if the following is worded inaccurately, I’m a WP beginner. I’ve recently installed the Customizr 4.0.8 [as a child theme] on a Localhost, […]

Custom Post Type rewrite

I’m trying to link to custom post types via url. So I have CPT ‘forums’ (example.com/forums) and CPT ‘topics’ (example.com/topics) I am trying to achieve a url of the two combined (for CPT ‘topics’) plus adding meta data in between (example.com/forums/forumname/topic/topicname) is this possible? //register post type register_post_type( ‘forums’, array( ‘labels’ => $labels, ‘has_archive’ => […]

WordPress Orderby Numeric Value Not Working

I am trying to get all products from the wpsc-product post type and then display them by a custom meta field called release_date_year. However, it doesn’t appear to be ordering my posts by this custom meta value. I have read through countless blog posts, support posts on the WordPress forums and a lot of questions […]

grant a privilege for roles (for example editors) and higher

My wordpress theme has a custom post-type. Only editors (and higher) should be allowed to use this post type. I did this with: function add_capability($role,$cap) { $role_obj = get_role($role); // get the the role object $role_obj -> add_cap($cap); // add $cap capability to this role object } function set_cpt() { add_capability(‘editor’, ‘edit_cpt’); add_capability(‘editor’, ‘read_cpt’); add_capability(‘editor’, […]

How do you modify the 'post_parent' of a custom post type?

I want to be able to edit the post_parent of a custom post type. Basically in my use case I want to mimic how WordPress uses attachments: have a custom post type that is sort of a subtype to post or any other post type. WordPress uses the post_parent field on the wp_posts table to […]

After creating hierarchical post type, still not getting any way to set parent

After creating a custom post type like below, I still dont get any option to set the parent of the post, am I missing something? register_post_type( ‘projects’, array( ‘labels’ => array( ‘name’ => ‘Projects’, ‘singular_name’ => ‘Project’ ), ‘public’ => true, ‘capability_type’ => ‘post’, ‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘excerpt’, ‘comments’), ‘hierarchical’ => true, ‘menu_position’ […]

Associate Taxonomies Across Post Types

Let’s say I’ve created two custom post types, one called post_type_author and another called post_type_book. In each of these two custom post types, I’ve created a non-hierarchical taxonomy for tags. What is the best way to associate these two custom post type’s taxonomies? Also, if I wanted to link these two along with the default […]

How many Custom Post Types to register?

My current WordPress site only exists of pages. The structure is as simple as this: example.com/hotels example.com/attractions example.com/restaurants I want to use Custom Post Types to add listings about individual hotels, attractions and restaurants. The new structure will look like this: example.com/hotels/myhotel example.com/attractions/myattraction example.com/restaurants/myrestaurant With myhotel/myattraction/myrestaurant being a Custom Post Type. All listings share the […]