Custom Post Types
-
As noted in this post, I was using a combination of The Events Calendar and WPtouch plugins at //https://pvwd080814wmaapp.pioneervalleywebdesign.com/events/
I was having trouble with the Events Custom Post Type.I switched to JetPack Mobile Theme and that fixed the Events CPT issue, but broke the other custom post type, members. Below is what I am using in functions.php of a twenty eleven child theme:
add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'members', array( 'labels' => array( 'name' => __( 'Members' ), 'singular_name' => __( 'Member' ) ), 'public' => true, 'has_archive' => true, 'show_ui' => true, 'show_in_nav_menus' => true, 'menu_position' => 5, 'rewrite' => array( 'slug' => 'members', 'with_front' => FALSE, ), 'exclude_from_search' => FALSE, 'publicly_queryable' => TRUE, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'comments', 'revisions', 'post-formats', ), 'taxonomies' => array('category', 'post_tag',), 'update_count_callback' => '_update_post_term_count' )); } add_filter('pre_get_posts', 'query_post_type'); function query_post_type($query) { if(is_category() || is_tag()) { $post_type = get_query_var('post_type'); if($post_type) $post_type = $post_type; else $post_type = array('nav_menu_item','post','members','tribe-events','tribe-venue','tribe-organizer',); $query->set('post_type',$post_type); return $query; } }
On mobile, the members url takes you to the homepage and none of the taxonomies work, category or tag.
Any thoughts?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Custom Post Types’ is closed to new replies.