Articles of custom post types

custom taxonomy relationship

I’m customizing wordpress by creating several taxonomies for a website. Actually, I created ‘Services’ custom post type with several taxonomy in it. Then, I’m going to create ‘Case History’ custom post type where I’d like to re-use ‘Service’ posts. I can show them on the backend (Case History add new item) by using WP_Query, but […]

Row actions not showing? Why?

I have constructed a WP_List_Table that displays on a custom theme page that I have built. I am having some trouble getting the row actions to display, despite me reviewing all the possible info on the Internet about WP_List_Table. Any help would be great! class Testimonials_List_Table extends WP_List_Table { function __construct() { parent::__construct( array( ‘singular’=> […]

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