Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pagination not working on custom post excerpts

Posted on 2014-01-13
6
Medium Priority
?
395 Views
Last Modified: 2014-01-23
Dear experts,

Could you please help me to know why the pagination I am applying to post excerpts is not working?

Any help would be greatly appreciated it.

function places_loop() {
    $loop = new WP_Query( array( 'post_type' => 'places', 'posts_per_page' => 4, 'paged' => get_query_var( 'paged' ) ) ); ?>
                <h1><?php the_title(); ?></h1>
            <div id="specials">
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
           
            <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
            <div id="post-<?php the_ID(); ?>" class="places-list">
            <?php//use the genesis_get_custom_field template tag to display each custom field value ?>
            <h3><?php echo the_field('phone_number'); ?></h3>

            </div><!--end #specials -->
    <?php endwhile;?>
    <?php
    }
 
    genesis();


Thanks,

Winter
0
Comment
Question by:glepiza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 39777031
What's the output you're getting and what are you expecting?
0
 

Author Comment

by:glepiza
ID: 39777228
Thanks for answering my question.

Attached goes an screenshot as a reference. I am getting the post excerpts but I am not getting the pagination to go to the next post excerpts.

Thanks in advance,
pagination.jpg
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 39777269
Pagination involves stopping the output so that only the content for a given page is shown, then giving the user the controls to select the next page. Once a user indicates what page they want next, the process repeats itself.

There isn't any code that I can see that would build out the user controls for pagination (unless "genesis()" is supposed to do it, but that's custom code, so you'd have to talk to whoever the original developer was).
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

Accepted Solution

by:
glepiza earned 0 total points
ID: 39791627
ok, I found the answer in some genesis tutorials:

function be_custom_loop() {
      global $post;

      // arguments, adjust as needed
      $args = array(
            'post_type'      => 'places',
            'posts_per_page' => 2,
            'post_status'    => 'publish',
            'paged'          => get_query_var( 'paged' )
      );

      /*
      Overwrite $wp_query with our new query.
      The only reason we're doing this is so the pagination functions work,
      since they use $wp_query. If pagination wasn't an issue,
      use: https://gist.github.com/3218106
      */
      global $wp_query;
      $wp_query = new WP_Query( $args );

      if ( have_posts() ) :
            echo '<div>';
            while ( have_posts() ) : the_post();
                  echo '<h3><a href="' . get_permalink() . '"> ' . get_the_title() . ' </a> </h3>'; // show the title
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 39791746
Glad to hear it!
0
 

Author Closing Comment

by:glepiza
ID: 39802543
I found the answer.

Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video teaches users how to migrate an existing Wordpress website to a new domain.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question