Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   [SOLVED] Pagination with Custom Post types, and Custom Page template (http://forum.bytesforall.com/showthread.php?t=21107)

magesm Nov 6, 2013 02:49 PM

[SOLVED] Pagination with Custom Post types, and Custom Page template
 
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?

juggledad Nov 6, 2013 03:59 PM

I'd have to see the complete file to give you any help.

magesm Nov 6, 2013 04:10 PM

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(); ?>


magesm Nov 6, 2013 04:48 PM

Figured it out myself. I had renamed the query variable $loop, and Atahualpa expects it to be $wp-query.


All times are GMT -6. The time now is 01:16 AM.

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