• Hi,

    The page that I am referring to can be found at:
    dev1.invatatenis.ro/terenuri-tenis-camp.

    There are 4 posts there – 2 have location Braila and 2 have location Bucuresti. Location is a custom field for posts. There is 1 post per page.

    I have a drop down list in which I can filer the posts based on location.
    By default, there are 4 pages, a page per post.

    If I chose Braila for example, there will be 2 pages, because there are 2 post with Braila. The problem appears here, when I click second page – the second page here is actually the second from all the 4 pages before using the drop down list.

    Here is the code that I am using:
    $aLocalitati = $wpdb->get_col( $wpdb->prepare(“SELECT DISTINCT (meta_value) FROM wp_postmeta WHERE meta_key=’Localitate'”));
    asort($aLocalitati);
    //arguments of query posts – default for all localities
    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $category = ‘terenuri-tenis-camp’;
    $args=array(
    ‘category_name’=> $category,
    ‘posts_per_page’=> 15,
    ‘paged’=>$paged,
    );

    if(isset($_POST[‘select_location’])) {
    $selected_location = $_POST[‘select_location’];
    if($selected_location != “all”) {
    $args=array(
    ‘category_name’=> $category,
    ‘posts_per_page’=> 15,
    ‘paged’=>$paged,
    ‘meta_key’=> ‘Localitate’,
    ‘meta_value’=> $selected_location,
    );
    }
    }
    ?>
    <table>
    <tr>
    <td style=”padding: 10px;”>Filtreaza dupa locatie:</td>
    <td><form name=”location_form” action=”<? echo get_bloginfo(wpurl).’/’.$category;?>” method=”post”>
    <select class=”select” name=”select_location” onchange=”this.form.submit();”>
    <option value=”all”>Oricare</option>
    <?
    foreach ( $aLocalitati as $location ) {
    if (isset($selected_location) and $selected_location == $location) {
    echo ‘<option value=”‘.$location.'” selected=”selected”>’.$location.'</option>’;
    } else {
    echo ‘<option value=”‘.$location.'”>’.$location.'</option>’;
    }
    }
    ?>
    </select>
    </form>
    </td>
    </tr>
    </table>

    <?php
    $temp_query = $wp_query;
    query_posts($args);

    if (have_posts()) :
    while (have_posts()) : the_post(); ?> …………

    <?php endwhile; ?>
    <?php if(function_exists(‘wp_paginate’)) {
    wp_paginate();
    } ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pegroeg

    (@pegroeg)

    The ‘posts_per_page’=> 15 is actually ‘posts_per_page’=> 1;

    Plugin Author Eric

    (@emartin24)

    WP-Paginate uses values set by WordPress. If the plugin is not working, it means there is something wrong with your query or set-up.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP-Paginate] query_post parameters are not retained starting from second page’ is closed to new replies.