WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Put a post (from a category) into the header (2 posts)

  1. AardvarkGirl
    Member
    Posted 1 year ago #

    I know just enough to be dangerous.

    I'm using this in the header, but (and probably obvious to some of you) it is putting THAT post into the content area of every page of the site. :-P

    The code I'm using in the header:

    <?php query_posts('category_name=header-post&posts_per_page=1'); ?>
            <?php while (have_posts()) : the_post(); ?>
         <?php the_title(); ?>
         <?php the_excerpt(); ?>
                      <?php endwhile; ?>

    With the thought that if someday the client deletes the original post (not calling that one post in by its ID number) that they can put another post in the category 'header-posts' and be back on track.

    But obviously this is mucking things up. :)

    I searched the web and found a few articles that really didn't help ( http://wordpress.org/support/topic/want-to-put-single-custom-posts-in-header-and-footer?replies=12 )
    Danke in advance for the help.

  2. AardvarkGirl
    Member
    Posted 1 year ago #

    I found the solution. Ad this to the end;

    <?wp_reset_query();?>

Topic Closed

This topic has been closed to new replies.

About this Topic