Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

[SOLVED] Pagination with Custom Post types, and Custom Page template


  #1  
Old Nov 6, 2013, 03:49 PM
magesm
 
3 posts · Nov 2013
I am having trouble getting pagination to show up for my custom post type, even though the settings are properly set in the Atahualpa control pages.

I have created a custom post type called "reviews". In order to display all the content I wanted, I also created a reviews custom page template in the theme folder based upon Atahualpa's index.php, but using an alternative WP_Query. Although I have pagination set to appear in Atahualpa, and it does appear on standard posts, but not on my custom post type page. I do have the appropriate hooks in my page template:
Code:
bfa_next_previous_page_links('Bottom');
So, how can I connect my custom post type to Atahualpa's logic so it knows to properly display pagination when there are more posts than fit on a page?
  #2  
Old Nov 6, 2013, 04:59 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
I'd have to see the complete file to give you any help.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Nov 6, 2013, 05:10 PM
magesm
 
3 posts · Nov 2013
Sorry for the length of this... And thank you for any help that you can offer. As you can see, all that is changed is that I replaced the bfa_post_kicker() to the bfa_post_footer() function calls with a reference to the template part associated with the post type, and hooked in a custom Query...

All the other Atahualpa functions are working swimmingly on this page, and the multiple posts (standard post type) have the of the next/previous links appearing properly.

More information that I discovered: I do get page navigation for "< Newer" only if I manually go to /reviews/page/2/ by inserting previous_posts_link(), but though there are also "Older >" custom post types, this nav element is not showing up.

Code:
<?php
/*
Template Name: Reviews
*/


list($bfa_ata, $cols, $left_col, $left_col2, $right_col, $right_col2, $bfa_ata['h_blogtitle'], $bfa_ata['h_posttitle']) = bfa_get_options();
get_header(); 
extract($bfa_ata); 
global $bfa_ata_postcount;
?>

<?php
$mypost = array( 
				'post_type' => 'cyc_review',
				);

$loop = new WP_Query( $mypost );


 /* If there are any posts: */
if ($loop->have_posts()) : $bfa_ata_postcount = 0; /* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?>
	<div id="cyc_reviews" class="cyc_reviews">
    <?php  if ($bfa_ata['widget_center_top'] <> '') { 
          echo bfa_parse_widget_areas($bfa_ata['widget_center_top']); 
	} ?>

	<?php // Deactivated since 3.6.5
	# include 'bfa://content_above_loop'; 
	// Uses the following static code instead: ?>
	<?php bfa_next_previous_page_links('Top'); // For MULTI post pages if activated at ATO -> Next/Previous Navigation:  ?>

	<?php while ($loop->have_posts()) : $loop->the_post(); $bfa_ata_postcount++; ?>



	
		<?php // Deactivated since 3.6.5
		#include 'bfa://content_inside_loop'; 
		// Uses the following static code instead: ?>
		<?php bfa_next_previous_post_links('Top'); // For SINGLE post pages if activated at ATO -> Next/Previous Navigation  ?>
		<?php /* Post Container starts here */
		
		// ========================================================================================
		// = if it is a review page, then use the review template. otherwise, standard atahualpa. =
		// ========================================================================================
		
		if ( get_post_type( get_the_ID() ) === "cyc_review" ) {
			get_template_part( 'content', 'review' );
		} 
		?>

	<?php endwhile; ?>
	</div>
	
	
	<nav>
	    <?php previous_posts_link('&laquo; Newer') ?>
	    <?php next_posts_link('Older &raquo;') ?>
	</nav>
	
	
	<?php // Deactivated since 3.6.5
	# include 'bfa://content_below_loop'; 
	// Uses the following static code instead: ?>
	<?php bfa_next_previous_post_links('Middle'); // Displayed on SINGLE post pages if activated at ATO -> Next/Previous Navigation: ?>
	<?php bfa_get_comments(); // Load Comments template (on single post pages, and static pages, if set on options page): ?>
	<?php bfa_next_previous_post_links('Bottom'); // Displayed on SINGLE post pages if activated at ATO -> Next/Previous Navigation: ?>
	<?php bfa_next_previous_page_links('Bottom'); // Displayed on MULTI post pages if activated at ATO -> Next/Previous Navigation: ?>
						

    <?php if ($bfa_ata['widget_center_bottom'] <> '') { 
          echo bfa_parse_widget_areas($bfa_ata['widget_center_bottom']); 
    } ?>

<?php /* END of: If there are any posts */
else : /* If there are no posts: */ ?>

<?php // Deactivated since 3.6.5
#include 'bfa://content_not_found'; 
// Uses the following static code instead: ?>
<h2><?php _e('Not Found','atahualpa'); ?></h2>
<p><?php _e("Sorry, but you are looking for something that isn't here.","atahualpa"); ?></p>

<?php endif; /* END of: If there are no posts */ ?>


<?php get_footer(); ?>

Last edited by magesm; Nov 6, 2013 at 05:40 PM.
  #4  
Old Nov 6, 2013, 05:48 PM
magesm
 
3 posts · Nov 2013
Figured it out myself. I had renamed the query variable $loop, and Atahualpa expects it to be $wp-query.

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling sidebars in custom post types SCUIE Sidebars & Widgets 2 Jul 26, 2013 02:24 AM
conditional formatting for custom post types titaniumbones Center area post/pages 0 Feb 22, 2011 10:15 AM
How to show Custom Post Types in Atahualpa? GreenCoast Center area post/pages 2 Feb 15, 2011 04:46 PM
Feature Request: option settings for custom post types (WP 3.1) webalyst New Versions, & Updating 0 Jan 4, 2011 03:56 PM


All times are GMT -6. The time now is 12:15 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.