Community Forums › Forums › Archived Forums › Design Tips and Tricks › Pagination on Custom Taxonomy
- This topic has 4 replies, 3 voices, and was last updated 9 years, 6 months ago by codydoodle.
-
AuthorPosts
-
September 30, 2014 at 12:00 pm #126325codydoodleMember
This may be a general wordpress problem but I think it is a Genesis problem since I am using the genesis_custom_loop function to create the page.
here is the code used to create my custom taxonomy archive page
<?php remove_action('genesis_loop', 'genesis_do_loop'); add_action('genesis_loop', 'custom_loop'); function custom_loop() { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $id = $term->name; $args = (array( 'post_type' => array( 'ddc_products' ), 'ddc_product_categories' => $id, )); genesis_custom_loop( $args ); } remove_action('genesis_entry_content', 'genesis_do_post_content'); add_action('genesis_entry_content', 'ddc_products_content', 1); function ddc_products_content() { ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('thumbnail'); ?></a> <?php } remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); genesis();
In the Settings I have it set to show 12 posts which works on this page. It then shows the pagination links below the loop. When clicking on any of the links to get pagination. I get a 404 page in response. It is simply not loading the template at all because the 404 page is returned with the default site layout instead of the full width layout like I created here in the filter.
Any help would be appreciated
http://doodledogadvertising.com/reads/products/category/engraved-rings/gold-engraved-collection/September 30, 2014 at 12:09 pm #126329Genesis DeveloperMemberYou can create a taxonomy file "taxonomy-ddc_product_categories.php" and add the following code in this file
<?php add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); remove_action('genesis_entry_content', 'genesis_do_post_content'); add_action('genesis_entry_content', 'ddc_products_content', 1); function ddc_products_content() { ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('thumbnail'); ?></a> <?php } genesis();
I think that this will solve your issue.
September 30, 2014 at 1:38 pm #126339codydoodleMemberI think I didn't explain myself clearly enough. I do have that file created and everything I posted in the first post is what I have in that template file.
If I replace what I have with what you have I get a page that says no results found.
September 30, 2014 at 6:08 pm #126369Brad DaltonParticipantAlso, when you add a custom post type in Genesis, make sure you add support for taxonomies not categories
October 1, 2014 at 7:43 am #126421codydoodleMemberI don't know what that link is trying to tell me. Here is how I register my post type and taxonomy
// Register Custom Taxonomy function ddc_create_taxonomies() { $labels = array( 'name' => 'Categories', 'singular_name' => 'Category', 'menu_name' => 'Categories', 'all_items' => 'All Categories', 'parent_item' => 'Parent Category', 'parent_item_colon' => 'Parent Category:', 'new_item_name' => 'New Category Name', 'add_new_item' => 'Add New Category', 'edit_item' => 'Edit Category', 'update_item' => 'Update Category', 'separate_items_with_commas' => 'Separate Categories with commas', 'search_items' => 'Search Categories', 'add_or_remove_items' => 'Add or remove Categories', 'choose_from_most_used' => 'Choose from the most used Categories', ); $rewrite = array( 'slug' => 'products/category', 'with_front' => false, 'hierarchical' => true, ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_tagcloud' => true, 'rewrite' => $rewrite, ); register_taxonomy( 'ddc_product_categories', 'ddc_products', $args ); } // Hook into the 'init' action add_action( 'init', 'ddc_create_taxonomies' ); function ddc_create_post_types() { //Register Support Topics $labels = array( 'name' => 'Products', 'singular_name' => 'Product', 'add_new' => 'Add New', 'add_new_item' => 'Add New Product', 'edit_item' => 'Edit Product', 'new_item' => 'New Product', 'view_item' => 'View Product', 'search_items' => 'Search Products', 'not_found' => 'No Products found', 'not_found_in_trash' => 'No Products found in Trash', 'parent_item_colon' => 'Parent Product:', 'menu_name' => 'Products', ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'description' => 'Products', 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions', 'genesis-cpt-archives-settings', 'genesis-seo' ), 'taxonomies' => array( 'ddc_product_categories' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 20, //'menu_icon' => 'this.jpg', 'publicly_queryable' => true, 'exclude_from_search' => true, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => array( 'slug' => 'products' ), 'capability_type' => 'post' ); register_post_type( 'ddc_products', $args ); } add_action( 'init', 'ddc_create_post_types' );
FYI, this code is in a plugin not the themes function.php file but that shouldn't matter
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.