how to use two permalinks for one custom post type
how to use two permalinks for one custom post type
how to use two permalinks for one custom post type
Hi @Manny Fleurmond: You can add the following HTML to a post metabox you’ll have an edit field that lets you edit the raw post_parent ID. Maybe with this knowledge you can build what you need? <input type=”text” id=”parent_id” name=”parent_id” value=”<?php echo $post->post_parent; ?>” />
Before I start, you have a bug in your code which you should have picked up if you had debug turned on. You are first assigning $r[‘cat’] to a variable before even checking if $r[‘cat’] is set. Because cat is not a default, it may not be set, which will cause a PHP error when … Read more
You’ll have to add your own rewrite rules to make this work, no way around that. First, don’t use the %category% rewrite tag, register your own tag and use that for the CPT categories: function wpd_query_vars( $qvars ) { $qvars[] = ‘cptcat’; return $qvars; } add_filter( ‘query_vars’, ‘wpd_query_vars’ ); You can then swap that tag … Read more
Query variable only can be accessed after wp_query has been called. In you call, the get_post_type() function is actually returning an empty value. It should be working, if you change the hook to something which fires after wp_query is called. So, You should use – add_action(‘wp’, ‘kiwi_remove_post_author_box’); OR add_action(‘template_redirect’, ‘kiwi_remove_post_author_box’); Also, hooks can removed with … Read more
Your original function relies on the $_POST[‘post_type’] being set to the appropriate value. As a general rule, you should avoid using global variables – if you use only want the function gives to you, you don’t have to think about the contexts in what it should be called. In this case, that’s what’s happened. You’re … Read more
The context of your code that fails isn’t entirely clear, but it’s failing because get_the_ID() won’t return a post ID when run on the init hook, because the main query hasn’t been executed yet. If you have a look at the Action Reference, wp is the earliest action where you can access the current query’s … Read more
Just remove query_posts(“post_type=shorts”); from your code.
It appears that the options-reading.php file is hard-coding its options, rather than using the Settings API. And that option is using wp_dropdown_pages() specifically. The Codex lists the following arguments for wp_dropdown_pages(): <?php $args = array( ‘depth’ => 0, ‘child_of’ => 0, ‘selected’ => 0, ‘echo’ => 1, ‘name’ => ‘page_id’); ?> The Codex page also … Read more
post_type accepts an array. Have you tried using WP_Query with an array? $args = array( ‘post_type’ => array( ‘product’, ‘banner’, ‘portfolio’, ‘testimonial’), ‘post_status’ => ‘publish’, ‘posts_per_page’ => 100 ); $the_query = new WP_Query( $args );