bigevilbrain
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Themes and Templates
In reply to: Pagination with custom post type listing@rafaelxy: Thanks a ton! This also worked for me. Perfect.
I’ve got two custom post types I’m using: caststudy and partner.
I switched my page-slug to “case-study” (from “case-studies”) and to “partner” (from “partners”) and the pagination works!
“Archive” Pages
page-case-study.php
page-partner.phpSingle View
single-casestudy.php
single-partner.phpI also figured out a way to fool wp_list_pages() into highlighting the correct “parent page” when viewing any single custom post-type “page” (rather than highlighting the “blog” page.)
This is really ugly but it works.
<?php $defaults = array( 'depth' => 0, 'title_li' => '', 'echo' => 1, 'sort_column' => 'menu_order, post_title', 'sort_order' => 'asc', 'link_before' => '', 'link_after' => ''); global $post, $wp_query; if (get_query_var('post_type') == 'casestudy') { // Load up the 'Case Studies' page to fool WP. $page = get_page_by_title('Case Studies'); $temp_post = $post; $temp_query = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query(array('page_id' => $page->ID)); wp_list_pages($defaults); // Restore previous wp_query. $wp_query = null; $wp_query = $temp_query; $post = $temp_post; } else if (get_query_var('post_type') == 'partner') { // Load up the 'Partners' page to fool WP. $page = get_page_by_title('Partners'); $temp_post = $post; $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query(array('page_id' => $page->ID)); wp_list_pages($defaults); // Restore previous wp_query. $wp_query = null; $wp_query = $temp_query; $temp_query = $temp_post; } else { // A normal page. wp_list_pages($defaults); } ?>
Hope that helps someone.
Forum: Themes and Templates
In reply to: How to remove alt/title of links?Thanks Veganist, this help me also.
Viewing 2 replies - 1 through 2 (of 2 total)