Articles of custom post types

Editable Meta Data for Custom Post Type Archive Template

My question is one of theming best practices. I constantly running into an issue were I have to display editable content on a custom post type archive page for client work – such as an image, body of text or custom page title. I’ve found this post and it references the options api. I’m not […]

Add a label to the editor?

I’m working on a custom post type. I have the editor enabled but the content that will go in that box is secondary and it isn’t clear what should be typed there so I want to add a label for the editor. How do I do that?

Create post programmatically

I want to create a video gallery plugin. I am using this code to create a post: global $user_ID; $new_post = array( ‘post_title’ => ‘chapter1’, ‘post_content’ => ‘Lorem ipsum dolor sit amet…’, ‘post_status’ => ‘publish’, ‘post_date’ => date( ‘Y-m-d H:i:s’ ), ‘post_author’ => $user_ID, ‘post_type’ => ‘post’, ‘post_category’ => array(0) ); $post_id = wp_insert_post( $new_post […]

How to call custom single post?

newbie here playing with php stuff, wanna learn. So the problem is. I have created custom posts and data from those is shown in a widget. Now i want to create custom single posts for those custom posts (dont get confused,yet). I have single.php which shows my post and with inside it i say if […]

Add CPT as subpage under custom page

I have created a menu page with the following code: add_menu_page(‘My Page’, ‘My Page’, ‘administrator’, ‘admin.php?page=my_page’, array($this, ‘my_page’)); And now I want to use custom post types on this page, also I want to create a few other custom post types, that are displayed as subpages from this page. I can’t really find how to […]

Rewrite WordPress URL to show CPT meta field data

I’m stuck in need of a rewrite rule. I have set up a custom post type for ‘Books’, each book has a repeatable field (using ACF Pro) for chapters. I have added a query_var for chapter using the code below… // Add chapter to query vars array function add_query_vars_filter( $vars ){ $vars[] = “chapter”; return […]

How to intercept publish post for a custom post type “event”

I am trying to write a plugin that copies a custom post type “event” from one blog to another. The code for copying I already have working but I cannot seem to get this “add_action” hook to work when an event is published. add_action(‘publish_event’, ‘copy_event_to_mini_site’ ); function copy_event_to_mini_site() { code in here to copy relevant […]

window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes

I have added two custom meta boxes to a custom post type. One is to upload an image to be stored in a custom field value for a “headshot” and the other is to upload an image to be stored in a custom field value for a “column headshot”. It’s a news site. Both send […]

advanced search forms with 3 input text and that the main problem 3 input text

N.B. : all my work is on wordpress. I was working for an advanced form with 3 input text in purpose to show a list of hotels. The problem is i tried an infinity tricks and functions but without any results, the only result i got is when i search with tag, but i have […]

wpdb custom post_type problem

I want to use custom post type in my custom SQL query, but, when I add the custom post type im my query, I get no results. Where’s my probelm ? This is the code I’ve tried $top5_ov_performance = $wpdb->get_results(“SELECT post_id,meta_value FROM “.$wpdb->prefix.”postmeta WHERE meta_key = ‘sd_top5_overclocing’ AND (post_type = ‘cpu’) ORDER BY meta_value DESC […]