• Resolved amagonagle

    (@amagonagle)


    Hello:

    I’m new to WordPress and I need to create a page of links from posts and I am not sure how to approach this. Here is what I am looking to do:

    1. In my nav I have 4 days that link to that days page (S-M-T-W);
    2. When a user clicks on one of the days (eg. Sunday) they go to a page of just titles from posts that are related to Sunday;
    3. When you click on the title it takes you to the full post page.

    Let me know if this is not clear. Any direction or guidance is greatly appreciated! Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • If your navigation bar shows Pages, here is a possible solution.

    • Copy the code below to your theme’s folder as postsforsunday.php.
    • Create a Page titled ‘Sunday’
    • Assign the template postsforsunday.
    • Assign the category ‘Sunday’ to all posts to show up on this page.
    • Do similar steps for other days, changing the template name and category.
    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    /*
    Template Name: postsforsunday
    */
    ?>
    <?php /*
     Author: Mac McDonald
     Contact at BluegrassMiataClub.com using About->Contact Us form.
    
     This program creates a list of posts by categories as links to the posts.
    
    Change the Template Name above and day in the array below.
    */?>
    
    <?php get_header(); ?>
    	<div id="content" class="narrowcolumn" role="main">
    
    <?php
    foreach (array('Sunday') as $catname) {
       $catid = get_cat_id($catname);
       $myquery = new WP_Query("cat=$catid");
       if ($myquery->have_posts()) :
          echo "<h2>Posts for Category $catname</h2>";
          while ($myquery->have_posts()) : $myquery->the_post(); ?>
             <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?></a></p>
          <?php endwhile;
       endif;
    }
    
    ?>
    </div><!-- End content -->
    <?php get_footer(); ?>
    Thread Starter amagonagle

    (@amagonagle)

    Works great! Exactly what I wanted to do. Thanks for your help!

    You are welcome! Now, please use the dropdown at top right to mark this topic ‘Resolved’.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Page of Links’ is closed to new replies.