Wordpress » Page shows Categories, pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gcoaster
    New Member
    • Sep 2007
    • 117

    Wordpress » Page shows Categories, pages

    Hello All..

    I need help with wordpress,
    I have figured out how to show certian posts with category in a page..
    but the page numbers are not working and i cant figure out why.

    Here is the code to query and show categories in california

    Code:
    <?php query_posts('category_name=california'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    for some reason the page numbers at the bottom are not working.. does anyone know what code i need to add?

    here is the page code, next and prev

    Code:
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

    thank you!
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Most likely you changed one variable somewhere to increase the num per page (probably hard coded it) and forgot to change it else where (where it still expects a variable, that may now be undefined for example).

    I don't know the WordPress code by memory to help you locate it.

    My advice: What code you posted is barely enough to cover your question. Try to understand what the code does, trace it, and find the problem.

    Good luck,



    Dan

    Comment

    • gcoaster
      New Member
      • Sep 2007
      • 117

      #3
      Hello Dan!

      here is the full code..

      Code:
      <?php
      /*
      Template Name: page_states
      */
      ?>
      
      <?php get_header(); ?>
      
      <div id="main">
      
      <div id="contentwrapper">
      
      <?php
      global $more;
      $more = 0;
      ?>
      
      <?php query_posts('category_name=california'); ?>
      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      
      
      <div class="topPost">
      <?php edit_post_link('Edit', ' | ', ''); ?></span></p>
      <h2 class="topTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
        <p class="topMeta">Location » <?php the_category(', '); ?>
        <div class="topContent"><?php the_content('(More Info...)'); ?></div>
      
      <div class="cleared"></div>
      </div> <!-- Closes topPost --><br/>
      
      
      <?php endwhile; ?>
      <?php endif; ?>
      
      
      <div class="navigation">
      <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>  
      </div><!-- Closes navigation-->
      
      
      <div class="cleared"></div>
      
      </div> <!-- Closes contentwrapper-->
      
      <?php get_sidebar(); ?>
      
      <div class="cleared"></div>
      </div><!-- Closes Main -->
      
      <div class="cleared"></div>
      <?php get_footer(); ?>

      Comment

      • dlite922
        Recognized Expert Top Contributor
        • Dec 2007
        • 1586

        #4
        No, I don't think you know how programming works. This is not the full code.

        The full code is multiple files probably, and I can't go through it for you to find your problem. (Unless you pay me ;) )

        My original point was for you to "Try to understand what the code does, trace it, and find the problem " yourself.

        If you don't know how a particular thing works, you have the manual at php.net to look up particular php function or otherwise ask us what a piece of code does, not the entire program.

        WordPress is an open source app. I'm sure they have help forums where you can get help. Those guys probably will know the entire code more than us.

        Good luck,




        Dan

        Comment

        • pdkadam
          New Member
          • Jul 2009
          • 6

          #5
          Its practically impossible to trace the error in a small code snippet that actually has roots & branches in multiple files.
          My advice is refer this for wordpress problems:

          and search for the exact solution.
          Sorry couldnt help much about it.

          Comment

          • gcoaster
            New Member
            • Sep 2007
            • 117

            #6
            Hello All!!

            FOUND IT!!!

            Here is the solution for Pagenation in Wordpress using a page template querying one category.!!! Enjoy! this was a HARD Find... Hope it helps someone

            <?php if(have_posts() ) : ?>
            <?php $paged = (get_query_var( 'paged')) ? get_query_var(' paged') : 1;
            query_posts("ca tegory_name=Cat egoryName&paged =$paged"); ?>
            <?php while(have_post s()) : the_post(); ?>


            In Christ,
            Matt

            Comment

            Working...