Saving fields in a drop-down in WordPress

This is the code from the WordPress core code – line 580: <label class=”screen-reader-text” for=”page_template”><?php _e(‘Page Template’) ?></label> <select name=”page_template” id=”page_template”> <option value=”default”><?php _e(‘Default Template’); ?></option> <?php page_template_dropdown($template); ?> </select> The only thing different from your code is <option value=”default”>. So I don’t think your code is the problem. Also the code for page_template_dropdown isn’t … Read more

current-menu-item not added on page showing custom post type (rendered with archive template)

If you using wp nav menu you can use this to add the current-menu-item class put this in your theme functions.php file and remember to change “mypageslug” to your wanted current page: function additional_active_item_classes($classes = array(), $menu_item = false){ global $wp_query; if ( $menu_item->post_name == ‘mypageslug’ && is_page_template(‘archive-expertizeom.php’) ) { $classes[] = ‘current-menu-item’; } return … Read more

show current item in custom menu, when inside a custom post type

Put this in your functions.php: function additional_active_item_classes($classes = array(), $menu_item = false){ global $wp_query; if(in_array(‘current-menu-item’, $menu_item->classes)){ $classes[] = ‘current-menu-item’; } if ( $menu_item->post_name == ‘product’ && is_post_type_archive(‘product’) ) { $classes[] = ‘current-menu-item’; } if ( $menu_item->post_name == ‘product’ && is_singular(‘product’) ) { $classes[] = ‘current-menu-item’; } return $classes; } add_filter( ‘nav_menu_css_class’, ‘additional_active_item_classes’, 10, 2 ); … Read more

Getting all ID’s matching a title in a custom post type

Just change the $args array to this: //Let’s say you’re searching the posts with the title ‘The searched post’: $pages = array(); $args1 = array( ‘s’ => ‘The searched post’, ‘post_type’ => ‘course-manager’, ‘posts_per_page’ => -1 ); query_posts( $args1 ); Your query_posts will return all the posts with the title alike ‘The searched post’.

previous_post_link in same taxonomy in custom post type

I’d suggest using a plugin for this. next_post_link and previous_post_link will use the category taxonomy (literally)*, so they will not work as expected with custom taxonomies, which I think you are using here. I’ve used both Smarter Navigation by Scribu and Ambrosite Next/Previous Post Link Plus, which are both great plugins for this sort of … Read more