Getting custom taxonomy from custom post type
You mean get_the_terms()? <?php $terms = get_the_terms( $post->ID, ‘block_type’ ); foreach($terms as $term) { echo $term->name; } ?> Or have I simplified this too much?
You mean get_the_terms()? <?php $terms = get_the_terms( $post->ID, ‘block_type’ ); foreach($terms as $term) { echo $term->name; } ?> Or have I simplified this too much?
Please refer below : function disable_new_posts() { // Hide sidebar link global $submenu; unset($submenu[‘edit.php?post_type=CUSTOM_POST_TYPE’][10]); // Hide link on listing page if (isset($_GET[‘post_type’]) && $_GET[‘post_type’] == ‘CUSTOM_POST_TYPE’) { echo ‘<style type=”text/css”> #favorite-actions, .add-new-h2, .tablenav { display:none; } </style>’; } } add_action(‘admin_menu’, ‘disable_new_posts’);
The following 2 filters allow you to hook into when WordPress checks the slug and are found in the function wp_unique_post_slug() in the wp-includes/post.php file. There are 2 filters, one for hierarchical posts and one for non-hierarchical. The hierarchical filter provides the ID for the post parent so if the $post_parent is 0, you know … Read more
You can stop the post from saving all together with minor JQuery hacks and validate the fields before saving on the client side or server side with ajax: first we add our JavaScript to capture the submit/publish event and use it to submit our own ajax function before the actual submit: add_action(‘wp_print_scripts’,’my_publish_admin_hook’); function my_publish_admin_hook(){ if … Read more
One way is to customize the SQL query executed using posts_clauses or other such filters. To find them search for posts_clauses in “wp-includes/query.php” & see the series of filters just before this line. These together are capable of customizing any part of the query Another thing you can do is manually merge the queried posts … Read more
And for displaying result for Filter then try this code add_filter( ‘parse_query’, ‘prefix_parse_filter’ ); function prefix_parse_filter($query) { global $pagenow; $current_page = isset( $_GET[‘post_type’] ) ? $_GET[‘post_type’] : ”; if ( is_admin() && ‘competition’ == $current_page && ‘edit.php’ == $pagenow && isset( $_GET[‘competition-name’] ) && $_GET[‘competition-name’] != ” ) { $competition_name = $_GET[‘competition-name’]; $query->query_vars[‘meta_key’] = ‘competition_name’; … Read more
EDIT – ANSWER REVISITED I’ve being working on another solution which is actually better the original answer. This does not involve any custom query and I think for all purposes my original answer can be dropped but kept for informational purposes I still believe you are on the homepage and will also treat this as … Read more
in Custom Post Type register arguments array use this ‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘comments’, ‘author’), This will activate author box on the edit screen. After registering author to cpt you need to activate author from edit screen option ( top of the edit screen where you can enable/disable all metabox ) to display authorbox … Read more
If you need next/previous links for single posts, there is the built in next_post_link function and matching previous_post_link, both of which should probably be used within the loop. For archives, use next_posts_link and previous_posts_link. All of these will work fine with custom post types.
You probably did not set the ‘hierarchical’ argument to true in your register_taxonomy. This would mean that it defaults to false, which gives you a tag-like interface. Add ‘hierarchical’ => true to your register_taxonomy.