[wp-hackers] page + 2 loops of posts?

Will Anderson wp-hackers at itsananderson.com
Fri Feb 27 17:53:39 GMT 2009


If you do this, whatever page you want to show up on the front will always
have to have the same name or id. This might not be the best solution
because if your user wants to change the page that goes on the front,
they'll have to edit your template.
The way I usually go about this is to create something like homepage.php (so
that it's not confused with the functionality of home.php) and put the
"template name" comment at the top so I can specify it as a template for
pages.

Then whatever page I want to show up at the front, I set as the "home" page
in the settings (show a static page rather than latest posts), and I specify
my homepage.php template as the template to use for that page.

When the template loads, whatever page it's supposed to display has already
been queried.

You could almost do this without the template thing by using home.php but
home.php is only used on the front page if you have your settings show
latest posts.

On Fri, Feb 27, 2009 at 12:31 PM, Joel Fisher <joelfisher at gmail.com> wrote:

> http://codex.wordpress.org/Template_Tags/query_posts
>
> Specifically:
>
> - page_id=7 - query for just Page ID 7
> - pagename=about - note that this is not the page's title, but the page's
> path
>
>
> Hope that helps.
>
>
> joel.fisher
> http://www.linkedin.com/in/jfisher
> www.twitter.com/joelmoney
>
>
>
>
> On Fri, Feb 27, 2009 at 12:28 PM, Jen Simmons <jensimmons at gmail.com>
> wrote:
> > Hey all,
> > I want to create a home page on a site with a main bit of text (something
> > the client can edit as a page) with 2 loops of posts after it (in 2
> > columns).
> >
> > I know how to create the loops... but I don't know how to write a php
> call
> > in home.php to pull the content from a specific page-id. (In the past I
> just
> > put a introduction like this in the html, and re-hack it to change it,
> but
> > I'd like the client to be able to edit the content without going into
> > home.php.
> >
> > I could just make one post in a fake category... and then put three loops
> of
> > posts on the home page. But I'd rather have the intro set up as a page.
> >
> > Is there a <php> phrase I can use to pull the content from a page? What
> is
> > it??
> >
> > thanks
> > Jen
> >
> >
> > Jen Simmons
> > Milkweed Media Design
> > http://milkweedmediadesign.com
> >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Will Anderson
http://www.itsananderson.com/


More information about the wp-hackers mailing list