SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2010
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    editing index file in child theme

    please advise how i get ONLY THE MOST RECENT blog posting FROM A SPECIFIC CATEGORY to appear on my index page (http://greenrefurbishing.com/wordpress/).

    i'm building a child theme of Twenty Ten. Should I be editing the index.php file in the TwentyTen theme folder? Or the index.php file in my child theme folder, or something else? I've already made changes to the index.php in the child theme folder in order add in that slider that you see.

    and after identifying which file, what code do i put there to get just the most recent post from a sepecific category?

    FYI, i was just starting to slightly get my head around child themes and the loop before 3.0 but now i'm completely lost. please advise. thanks in advance!

  2. #2
    SitePoint Addict
    Join Date
    May 2010
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    nevermind. figured it out.

    PHP Code:
    <?php
    $latestposts 
    get_posts('numberposts=1&category=12');
    foreach(
    $latestposts as $post) :
       
    setup_postdata($post);
    ?>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php the_excerpt(); ?>
    <?php 
    endforeach; ?>


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
  •