Post on page. Portfolio style
-
Hi,
I’ll start off by saying I’m completely new to WordPress. I’ve been playing around with it for about 2 days and I LOVE it =)
I use WP more like a portfolio than a blog. In WP you write either a post or a page. A page is intended for “timeless” or even static content, and a comment is posted as an event to one or more categories, like a blog.
I wanted to create pages with a little introductory text, and then “post” my (new) work / projects on those pages. I searched this forum looking for answers and found some statements like “you don’t post on a page in WP, period” and “posts are posts and pages are pages”.
After a little hacking around with page templates I’m happy to say this is simply NOT TRUE. I wanted to clear this up for anyone who likes to use WP as a website/portfolio instead of mainly a blog.
Note: Basic knowledge of php is required. You’ll have to dig into the theme code, but only a tiny bit…
(using the default/kubrick template)
1) create a page template by copying the default “page.php” and adding at the top:
<?php
/*
Template Name: YourTemplateName
*/
?>this will make it show up in the templates menu as “YourTemplateName” when you edit/write a page.
2) In the template, create a second (empty) content section right underneath the existing one like this:
<div id=”content” class=”narrowcolumn”>
</div>
3) Query the post(s) you want to add to your page by putting a query_post() at the top of your new content section:
<?php query_posts(‘category_name=myWork’); ?>
For example this line will simply query all the posts that are listed under the “myWork” category, but you can do whatever you like really. Check the docs.
4) Copy the “while” loop from archive.php and add it under the query statement. This will display the posts, looking the same as in your blog archive.
5) Create a new page, and assign the template to it.
That’s it! You can then tweak this “while” loop the way you want it to look. For example I wanted to display the post more like plain text paragraphs, so I removed the bottom line which shows the categories and allows people to comment and edit.
Its all up to you. You make the rules.
HTH Cheers,
Thijs
- The topic ‘Post on page. Portfolio style’ is closed to new replies.