WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been searching this subject for some time now, not finding a solution. First of all, sorry for my bad spelling. Im quit new to PHP, so please be gental.

Im using this to list some customfields:

<?php
$my_query = new WP_Query(array(
    'post_type'=>'post',
    'posts_per_page'=>'1'
));


while ($my_query->have_posts())
{
    $my_query->the_post();

    $emne = get_field( "emne" );
    $titel = get_field( "titel" );
    $forfatter = get_field( "forfatter" );
    $billede = get_field( "billede" );
    $land = get_field( "om_foredragsholder" );

    { ?>



    <a href="<?php the_permalink(); ?>" style="cursor:pointer;">
    <div class="content-holder-whitebox">
        <div class="whitebox">
            <div class="left">
                <h2><?php echo $emne ?></h2>
                <div class="title">"<?php echo $titel ?>"</div>
                <div class="navn"><?php echo $forfatter ?></div>
                <div class="mere-info">Mere info</div>
          </div>
             <div class="right">
             <div class="billede">
                    <img src="<?php echo $billede ?>" />
                    </div>
                    <div class="knap">
                    <img src="<?php bloginfo('template_directory'); ?>/images/booknu.jpg" />
                    </div>
          </div>
      </div>            
     </div>
    </a>

    <?php
    }
}

?>

Please, can some one help me getting working? I have installed the plugin WP-PageNavi.

Thank you so much.

share|improve this question

Try this one you need to add 'paged' => get_query_var('page') so your code in $my_query should be like this

$my_query = new WP_Query(array(
    'post_type'=>'post',
    'posts_per_page'=>'1',
    'paged' => get_query_var('paged')
));

You just need to pass along the ‘paged’ query var from the main query:

You can see also Codex page on query_posts()

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.