Articles of custom post types

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 […]

How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?

The default taxonomy, category. By default, only those with the edit_posts capability can assign categories during post creation/editing. I have a role with very limited capabilities. I want to let users in this role be able to assign categories during custom-post-type creation/editing, but I cannot give them the edit_posts capability and they should not be […]

Displaying Multiple Post types in Taxonomy

I have the following Custom Post Types which are all linked to the destination taxonomy. Deals Accommodation Attractions Articles How would I change the taxonomy-destination.php file to show matching posts from all 4 post types. For instance, when currently viewing the destination “los angeles”, it shows all this content together by date rather than separating […]

How to append text to title of Custom Post Type post (without affecting all titles on page)?

This question ‘How to correctly get post type in a the_title filter’ is exactly what I’m trying to achieve. I have set a filter as below but it affects all titles on the page (in the menu, sidebar and footer) rather than just the post title. Apparently I need to use the add_filter just before […]

Export entries and multiple custom field meta to .csv?

First time poster. I’m trying to export a bunch of custom posts out to a csv file so I can easily import them into a new database. I’ve ran the native export to xml, but it’s not the correct format I need. I need a column based format (ie. name, height, weight, etc.). I have […]