Articles of custom post types

Trying to add script to specific admin page is not working

What I am trying to achieve is to load a .js file on an edit.php page, however the code is not working specifically for this page. I’ve applied the same code type of code to other CPT pages, but for some reason this CPT page is not registering the script. Here is the code I […]

Loop that displays the first post of every available custom post type?

Is it possible to create a loop that goes through all the available custom post types without statically defining what those custom post types are, and then displaying the featured image of the first post for each of those custom post types?

Creating a function that receives the taxonomy terms that have been changed in a custom post type

Ive been looking into actions and hooks etc… from wordpress, but cant seem to do a very simple thing. I just want to execute a function whenever a post is updated, and within the function I want the names of the terms that have been changed on that save. So maybe some sort of before […]

Custom post type archive and single.php files not working

Hi I’ve created a custom post type called shows. here is the code for it. <?php add_action(‘init’, ‘show_register’); function show_register() { //arguments to create the post type. $args = array( ‘label’ => __(‘shows’), ‘singular_label’ => __(‘Show’), ‘public’ => true, ‘show_ui’ => true, ‘capability_type’ => ‘post’, ‘hierarchical’ => true, ‘has_archive’ => true, ‘supports’ => array(‘title’, ‘editor’, […]

How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page

This post shows how to remove unwanted fields from the media uploader. It works great, but I want to limit it to a custom-post-type and I can’t seem to figure out how to do it. I’ve tried the following code, but it doesn’t seem to work: add_filter(‘attachment_fields_to_edit’, ‘remove_media_upload_fields’, 10000, 2); function remove_media_upload_fields( $form_fields, $post ) […]

Exclude specific taxonomy term when using wp_get_post_terms

i have a single-post_type.php file where i constructud a breadcrumb (or similer to) i am currently using this to get the terms of this taxonomy: $terms = wp_get_post_terms( $post->ID, ‘wedding_cat’); . Later on i am showing that term like this: <div class=”breadcrumbs”><?php $term = array_pop($terms); echo ‘<a href=”‘. get_bloginfo(‘url’) .'”>’. __(‘Home’, ‘sagive’) . ‘</a> &raquo; […]

Get random custom posts from a custom post type

I created a custom post type named predic, I’m trying to get within one of this post other four random posts from the same custom post type. I used this code, but I keep getting the same post I’m in 4 times. <ul> <?php $rand_posts = get_posts(‘numberposts=4&orderby=rand’); foreach( $rand_posts as $post ) : ?> <li><a […]

Displaying custom post type on front page

I added a new custom post type to my WordPress theme but it refuses to show on the homepage. I tried setting <?php query_posts( array( ‘post_type’ => array(‘post’, ‘reviews’) ) );?> but it doesn’t seem to work, it just loops my normal posts. Any suggestions would be greatly helpful. Here’s a pastie of my index […]

Have a Custom Post Type index page display taxonomy items instead of posts

I have a CPT registered that is called lessons with a custom taxonomy (category) that is called courses. I want the /courses page (archive-courses.php?) to display the individual courses (i.e. “online marketing”, “paid advertising”) and not the individual posts (lessons). Would this mean I’d just customize the loop, or a complete custom WP_Query?

Custom Post Types for Support Ticket plugin?

I am about to write a (quite simple) plugin for support tickets, where a user signs up, adds one or more sites, and adds support tickets under each of the sites. My question is about how to structure this without relying on other plugins for functionality: The user signs up and gets a new role […]