Custom admin post.php page

I suggest you just don’t use the standard post editing UI. When you register your post type, there’s an arg for showing the admin UI. <?php register_post_type( ‘some_type’, array( // stuff here ‘show_ui’ => false ) ); Then just create your own admin page and do whatever you need to do with the interface. Here’s … Read more

Display upcoming Events for next 7 Days

I haven’t had much success in the past using the BETWEEN comparison with meta queries. You might have better luck by replacing your meta query with a >= and <= comparison: ‘meta_query’ => array( array( ‘key’ => ‘opening_time’, ‘value’ => $today, ‘compare’ => ‘>=’, ‘type’ => ‘DATE’ ), array( ‘key’ => ‘opening_time’, ‘value’ => $future, … Read more

How to get custom post types to play nice with schema.org (aka how to wrap the contents in the schema.org markup)?

The link has given you example HTML: <div itemscope itemtype=”http://schema.org/Recipe”> <span itemprop=”name”>Mom’s World Famous Banana Bread</span> By <span itemprop=”author”>John Smith</span>, <meta itemprop=”datePublished” content=”2009-05-08″>May 8, 2009 <img itemprop=”image” src=”https://wordpress.stackexchange.com/questions/33981/bananabread.jpg” /> <span itemprop=”description”>This classic banana bread recipe comes from my mom — the walnuts add a nice texture and flavor to the banana bread.</span> Prep Time: <meta … Read more

Display not found page 404 on specific Post Type

I have a script that wil; display a good 404 page for certain pages. Now I do not yet know what custom post types are, as I am just starting, but I think you can edit the script to fit your needs. add_action(‘template_redirect’, ‘my_template_redirect’); function my_template_redirect() { global $wp_query, $post; if (is_author() || is_attachment() || … Read more

How to store multiple values in 1 meta_key with radio input?

John, I’m not sure how you have the radio button set up, but WordPress easily handles multiple values in one meta_key. You simply need to place the values in an array before sending it to update_post_meta. For instance: $array = array( ‘foo’ => ‘foo_value’, ‘bar’ => ‘bar_value’ ); update_post_meta( $id, ‘my_meta_key’, $array ); WordPress automatically … Read more

How can we take into account post types when constructing permalinks?

When you register your taxonomy you can create the rewrite rule for the slug register_taxonomy(‘investment_country’,array(‘investment’), array( ‘hierarchical’ => true, ‘labels’ => $labels, ‘show_ui’ => true, ‘query_var’ => true, ‘rewrite’ => array( ‘slug’ => ‘country’ ), )); so whenever I’m showing something that I have included in the country taxonomy I get http://www.domain.com/country/unitedkingdom for example don’t … Read more

How to hook custom taxonomies to custom post types and make the permalinks work?

Two things – I think the category URL would be: yourdomain.com/news_category/NEWS-CATEGORY-SLUG-HERE So for example if you created a category “top headlines” in your “news_category” taxonomy… it would look like this (assuming the slug for “top headlines” is “top-headlines”): /news_category/top-headlines/ The second thing… I think your template name should be “taxonomy-news_category.php” (edited to add – I … Read more

How can I set taxonomy programmatically

You should hook your actions to the save_post hook. It fires right after the post is created and the $post_id and other $post data variables are already available. Something like this should do the trick: add_action( ‘save_post’, ‘jason_code_save_post’, 10, 2 ); function jason_code_save_post( $post_ID, $post ) { if ( ‘code’ != $post->post_type || wp_is_post_revision( $post_ID … Read more