Articles of custom post types

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?

How to stop wordpress from mangling HTML in a metabox textarea

Can anyone lend a hand and suggest the best way to get a textarea in a meta box to stop mangling HTML? I’ve been digging around here online… and here…and also here…looking for answers, but I don’t know how to piece them together properly to fit with what I’ve already done. Here’s what I have… […]

How can I display custom post types under multiple views?

I want to create custom post types with multiple views based on URL. E.g., suppose I have a “Product” post type. I would like to have something like the following: <– Regular view of the product/regular template <– Expanded view, extra info, more theme elements, widgets, etc. <– Quick view, less info, […]

Force unique page slugs across all post types

I have a site with many custom post types and I need a unique slug for each page. What I’m seeing is that wordpress only checks for slug conflicts within a post type before appending “-2”, “-3”. So I can have “actor/foo”, “book/foo”, “book/foo-2”. I don’t want that. I want each foo to have its […]