Welcome Guest!
Please login
If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:
- Receive Fast Advice
- Learn Programming Languages
- Get Professional Website Reviews
- Quick Troubleshooting Assistance
Wordpress - Posts On Different Pages
This is a discussion on Wordpress - Posts On Different Pages, within the Blogging & Social Networking section. This forum and the thread "Wordpress - Posts On Different Pages" are both part of the Designing Your Website category.
![]() ![]() |
Apr 21 2008, 05:12 PM
Post
#1
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Advisors Posts: 427 Joined: 14-February 08 From: Stockport Member No.: 75 |
I am not too experienced with Wordpress as you may guess to bear with me
What i want to do is create different pages, such as articles, tips & tricks, and what i want to do is publish posts on each page seperatly. When i post a post is there a way to specify which page it goes to? Thanks in advance Craig -------------------- |
|
|
Apr 21 2008, 09:23 PM
Post
#2
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,316 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
Those would be categories. You just don't have to name them as such on your site.
-------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
Apr 22 2008, 05:49 AM
Post
#3
|
|
![]() Squeezing ![]() ![]() ![]() Group: Members Posts: 67 Joined: 14-February 08 Member No.: 86 |
The following code will display all posts in a category. I set up my pages and categories so my 'Book' page will only have posts in category 'book'.
I haven't found a good way to figure out the cagegory id. The category ids are listed in the table wp_term_taxonomy. I just used trial and error to find the right ones. CODE <?php
// use the page id to get the corresponding category id if ( is_page('16') ) $myId = 6; elseif ( is_page('6') ) $myId = 7; else $myId = 3; $myArgs = "cat=$myId"; ?> <?php query_posts($myArgs); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="entry"> <?php the_content('Read the rest of this entry »'); ?> </div> </div> <?php endwhile; ?> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?> |
|
|
Apr 22 2008, 07:03 AM
Post
#4
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,316 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
I'm curious as to why you even need to do that?! I mean, those "pages" already exists when you select a category so ... why not just use those?
Like on webdesignerwall.com, see the Tutorials, Trends and General... those are his categories. He just display them differently. -------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
Apr 22 2008, 07:52 AM
Post
#5
|
|
![]() Squeezing ![]() ![]() ![]() Group: Members Posts: 67 Joined: 14-February 08 Member No.: 86 |
But a Page doesn't have a corresponding category by default. I am talking about the Pages that are displayed as a navigation list with the wp_list_pages() function in header.php.
It's my understanding that those Pages are static by default (About, Contact) but you can define a page template that will be run instead of displaying the default information. I use the above code to display posts of a certain category on the page. Any wordpress knowledge I have, I got from a week of slogging through wp documentation so if there is an easier way, I'd love to know what it is. |
|
|
Apr 22 2008, 08:12 AM
Post
#6
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,316 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
But a Page doesn't have a corresponding category by default. I am talking about the Pages that are displayed as a navigation list with the wp_list_pages() function in header.php. It's my understanding that those Pages are static by default (About, Contact) but you can define a page template that will be run instead of displaying the default information. I use the above code to display posts of a certain category on the page. Yeah ... Pages are static but what I'm saying is why would you use a Page instead of the Category? Any wordpress knowledge I have, I got from a week of slogging through wp documentation so if there is an easier way, I'd love to know what it is. I'm just learning as I go so sorry for being stubborn... just trying to understand the whole -------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
Apr 22 2008, 08:28 AM
Post
#7
|
|
![]() Squeezing ![]() ![]() ![]() Group: Members Posts: 67 Joined: 14-February 08 Member No.: 86 |
Yeah ... Pages are static but what I'm saying is why would you use a Page instead of the Category? Because I want some categories to be part of my main navigation along with About and Contact. So wp_list_pages() returns: Books | Interviews | About | Contact Books displays all the posts with category 'book'. Interviews displays all the posts with the category 'interview'. About displays static about information. Contact displays static contact information. There are other categories (blog and podcast for example) that are displayed in the sidebar. |
|
|
Apr 22 2008, 09:12 AM
Post
#8
|
|
![]() Co-Founder ![]() ![]() ![]() ![]() ![]() ![]() Group: Co-Founders Posts: 2,316 Joined: 13-February 08 From: Squeezin' Member No.: 2 |
Ok ....
wp_list_categories ... couldn't you just show those 2 categories and put them beside your Pages?! And then on your sidebar (or whatever) you can show the others with the "exclude" argument? -------------------- The Squeeze Store is now OPEN! Come on in and grab something!
a web design portfolio | web non-sense I'm also on: del.icio.us | flickr | virb | facebook | twitter The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN! |
|
|
Apr 22 2008, 01:27 PM
Post
#9
|
|
|
Master of the Universe ![]() ![]() ![]() ![]() ![]() Group: Mentor Posts: 984 Joined: 15-February 08 From: London, England Member No.: 141 |
Ok .... wp_list_categories ... couldn't you just show those 2 categories and put them beside your Pages?! And then on your sidebar (or whatever) you can show the others with the "exclude" argument? I agree with Karinne. A better way of approaching this would be to open up your header file and add your categories to the main navigation. Doesn't this do exactly the same as listing categories on a static page? |
|
|
Apr 22 2008, 04:28 PM
Post
#10
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Advisors Posts: 427 Joined: 14-February 08 From: Stockport Member No.: 75 |
A better way of approaching this would be to open up your header file and add your categories to the main navigation. Sorry to be a pain but how exactly would you do this, which header file is etc. All the php code is confusing me :S -------------------- |
|
|
Apr 22 2008, 05:36 PM
Post
#11
|
|
|
Master of the Universe ![]() ![]() ![]() ![]() ![]() Group: Mentor Posts: 984 Joined: 15-February 08 From: London, England Member No.: 141 |
Sorry to be a pain but how exactly would you do this, which header file is etc. All the php code is confusing me :S Are you familiar with the suckerfish menu? Anyway, Check out this link. http://codex.wordpress.org/Template_Tags/wp_list_categories CODE $defaults = array( 'show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '', 'hierarchical' => true, 'title_li' => __('Categories'), 'echo' => 1, 'depth' => 0 ); wp_list_categories($defaults); The defaults are explained in the first link. If you go to your template and open you header.php file you should find a containter div called nav. All you need to do is include this into the nav container at either the start or the end. The links will then be listed in, assuming you have the styling for it, a nice drop down menu. (Suckerfish menu is a bullet proof drop down menu. http://www.htmldog.com/articles/suckerfish/dropdowns/) |
|
|
Apr 22 2008, 08:08 PM
Post
#12
|
|
![]() Squeezing ![]() ![]() ![]() Group: Members Posts: 67 Joined: 14-February 08 Member No.: 86 |
I agree with Karinne. A better way of approaching this would be to open up your header file and add your categories to the main navigation. Doesn't this do exactly the same as listing categories on a static page? I wanted to be able to control the order they were listed in. Also for those pages I wanted to display the information differently than the category pages and still have the archive available by category. |
|
|
Apr 23 2008, 02:28 AM
Post
#13
|
|
|
Master of the Universe ![]() ![]() ![]() ![]() ![]() Group: Mentor Posts: 984 Joined: 15-February 08 From: London, England Member No.: 141 |
I wanted to be able to control the order they were listed in. Also for those pages I wanted to display the information differently than the category pages and still have the archive available by category. Your way may provide more styling options. However Craig asked for. QUOTE What i want to do is create different pages, such as articles, tips & tricks, and what i want to do is publish posts on each page seperatly. When i post a post is there a way to specify which page it goes to? There is no mention of additional styling and ordering options. As a result keeping it simple would be best option imo. |
|
|
Apr 23 2008, 04:15 AM
Post
#14
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Advisors Posts: 427 Joined: 14-February 08 From: Stockport Member No.: 75 |
Are you familiar with the suckerfish menu? Anyway, Check out this link. http://codex.wordpress.org/Template_Tags/wp_list_categories CODE $defaults = array( 'show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '', 'hierarchical' => true, 'title_li' => __('Categories'), 'echo' => 1, 'depth' => 0 ); wp_list_categories($defaults); The defaults are explained in the first link. If you go to your template and open you header.php file you should find a containter div called nav. All you need to do is include this into the nav container at either the start or the end. The links will then be listed in, assuming you have the styling for it, a nice drop down menu. (Suckerfish menu is a bullet proof drop down menu. http://www.htmldog.com/articles/suckerfish/dropdowns/) Cheers Jason, I will take a look at this tonight -------------------- |
|
|
Apr 23 2008, 04:42 AM
Post
#15
|
|
![]() The Rabbit King ![]() ![]() ![]() ![]() Group: Team Leaders Posts: 277 Joined: 13-February 08 From: Chasing carrots in Farmer Jack's farm! Member No.: 9 |
the header file is header.php under themes.
-------------------- My Websites: The Football Manager's Football Association | Pilgrims Way 3 Boat Ministry
My Blog: Random Rabbits New msn - please add it! < Snowy. Anger her and she will rip you to shreds! |
|
|
Apr 23 2008, 05:16 AM
Post
#16
|
|
|
Master of the Universe ![]() ![]() ![]() ![]() ![]() Group: Mentor Posts: 984 Joined: 15-February 08 From: London, England Member No.: 141 |
|
|
|
Apr 23 2008, 09:56 AM
Post
#17
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Advisors Posts: 427 Joined: 14-February 08 From: Stockport Member No.: 75 |
Your more than welcome, is this for your football blog site? Last night I had a nice feature idea for the site if your still building it. -------------------- |
|
|
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:






Apr 21 2008, 05:12 PM








< Snowy. Anger her and she will rip you to shreds!

