Slider from custom post type

If the purpose of the ID is just to set the order of the slides you are better off using the order attribute. Add page-attributes to the array for the supports argument in $feature_args Then in your loop you can specify &orderby=menu_order&order=ASC Then you can show it as a column you can refer to this … Read more

Custom Endpoint For Custom Post Type from Child Theme

When you register your custom post type, you should use rewrite like this: add_action(‘init’, ‘create_location’); function create_location() { register_post_type(‘location’, array( ‘labels’ => array( ‘name’ => __(‘Locations’), ‘singular_name’ => __(‘Location’) ), ‘public’ => true, ‘rewrite’ => array( ‘slug’ => ‘location’ ) ) ); } Don’t forget to update your permalinks by going to example.com/wp-admin/options-permalink.php and click … Read more

Filtered by a custom field, ordered by another

You are sorting it incorrectly. You will need to check for artist-status meta key with meta_query and sort by last-name metakey. Here is your query. $args = array( ‘post_type’ => ‘artist’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘last-name’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘meta_query’ => array ( array( ‘key’ => ‘artist-status’, ‘value’ => ‘invited’, ‘compare’ … Read more

Admin: Get all user for Custom Role

I find the solution, that’s a WordPress 4 year’s bug. Here is the Summary from DrewAPicture changed from manually created user roles not showing in author dropdown irregardless of assigned capabilities to Manually created user roles not showing in author dropdown regardless of assigned capabilities Please see ticket 16841 for more details. The only simple … Read more

Using a Single Custom Post Type Template for Multiple CPTs

Doesn’t exist any is_post_type_single function, because there is no need for it. is_singular() fit perfectly your purpose. Example code using ‘template_include’ filter: add_filter( ‘template_include’, function( $template ) { if ( is_singular( array( ‘cpt-1’, ‘cpt-2’, ‘cpt-3’ ) ) ) { $locate = locate_template( ‘custom-template.php’, false, false ); if ( ! empty( $locate ) ) { $template … Read more