SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast scott g's Avatar
    Join Date
    Jun 2012
    Location
    STL . MO
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HELP! Can't figure out how to add Page navigation (10 posts per page)

    Here's the code:
    PHP Code:
    <?php
    /*
    Template Name: Memorials
    */
    ?>
    <?php get_header
    (); ?>
    <?php 
    if (have_posts()) : ?>

    <div id="content">
        <!--page.php-->
    <div id="post" class="post clearfix">
    <div id="blog-heading"><h1>Memorials for Loved Ones Lost</h1></div>
    <div id="alpha">
    <a href="http://stlheroinhelp.org/tag/a/" title="List Memorials First Name Alphabetically 'A'"><u>A</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/b/" title="List Memorials First Name Alphabetically 'B'"><u>B</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/c/" title="List Memorials First Name Alphabetically 'C'"><u>C</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/d/" title="List Memorials First Name Alphabetically 'D'"><u>D</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/e/" title="List Memorials First Name Alphabetically 'E'"><u>E</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/f/" title="List Memorials First Name Alphabetically 'F'"><u>F</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/g/" title="List Memorials First Name Alphabetically 'G'"><u>G</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/h/" title="List Memorials First Name Alphabetically 'H'"><u>H</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/i/" title="List Memorials First Name Alphabetically 'I'"><u>I</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/j/" title="List Memorials First Name Alphabetically 'J'"><u>J</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/k/" title="List Memorials First Name Alphabetically 'K'"><u>K</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/l/" title="List Memorials First Name Alphabetically 'L'"><u>L</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/m/" title="List Memorials First Name Alphabetically 'M'"><u>M</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/n/" title="List Memorials First Name Alphabetically 'N'"><u>N</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/o/" title="List Memorials First Name Alphabetically 'O'"><u>O</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/p/" title="List Memorials First Name Alphabetically 'P'"><u>P</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/q/" title="List Memorials First Name Alphabetically 'Q'"><u>Q</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/r/" title="List Memorials First Name Alphabetically 'R'"><u>R</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/s/" title="List Memorials First Name Alphabetically 'S'"><u>S</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/t/" title="List Memorials First Name Alphabetically 'T'"><u>T</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/u/" title="List Memorials First Name Alphabetically 'U'"><u>U</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/v/" title="List Memorials First Name Alphabetically 'V'"><u>V</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/w/" title="List Memorials First Name Alphabetically 'W'"><u>W</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/x/" title="List Memorials First Name Alphabetically 'X'"><u>X</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/y/" title="List Memorials First Name Alphabetically 'Y'"><u>Y</u></a>&nbsp;
    <a href="http://stlheroinhelp.org/tag/z/" title="List Memorials First Name Alphabetically 'Z'"><u>Z</u></a>&nbsp;
    </div>
    <?php
        $recentPosts 
    = new WP_Query();
        
    $recentPosts->query('showposts=10&cat=3');
    ?>
    <?php 
    while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
    <div id="h2-memorial">
        <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    </div>
    <?php the_excerpt(); ?>
    <?php 
    endwhile; ?>


    <div class="page-nav">
    <?php wp_pagenavi(); ?>    </div>

    <!--page.php end-->
    </div>
    </div>
    <?php endif; ?>
    <?php get_sidebar
    (' '); ?>
    <?php get_footer
    (' '); ?>
    Link to page: http://stlheroinhelp.org/memorials/

    There are more than 10 posts but no navigation... Help please! Much appreciated! I' stuck...

    --Scott G.

  2. #2
    SitePoint Enthusiast scott g's Avatar
    Join Date
    Jun 2012
    Location
    STL . MO
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Same thing with page navigation on this template as well... I have no clue what I'm doing wrong or wtf I changed... Please help!

    PHP Code:
    <?php
    /*
    Template Name: Blog
    */
    ?>
    <?php get_header
    (); ?>
    <?php 
    if (have_posts()) : ?>

    <div id="content">
        <!--page.php-->
    <div id="post" class="post clearfix">
    <div id="blog-heading"><h1>Blog &amp; News Articles</h1></div>

                <?php query_posts(array('paged' => get_query_var('paged'),'posts_per_page' =>10)); ?>
                <?php query_posts('cat=-3'); ?>
                <?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>

        <!--post title-->
        <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>

        <!--post text with the read more link-->
    <?php the_excerpt(); ?>

        <!--for paginate posts-->
        <?php link_pages('<p><strong>Pages:</strong> ''</p>''number'); ?>

        <?php //comments_template(); // uncomment this if you want to include comments template ?>


        <?php endwhile; // end of one post ?>
    <div class="page-nav">
    <?php      wp_pagenavi(); ?>    </div>
        <?php else : // do not delete ?>
        <h3>Page Not Found</h3>
        <p>We're sorry, but the page you are looking for isn't here.</p>
        <p>Try searching for the page you are looking for or using the navigation in the header or sidebar</p>

        <?php
    endif; // do not delete ?>

    <!--page.php end-->
    </div>
    </div>
    <?php endif; ?>
    <?php get_sidebar
    (' '); ?>
    <?php get_footer
    (' '); ?>
    http://stlheroinhelp.org/blog/

    Thank you!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •