Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Website Design
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 09-10-2009, 10:34 PM   #1
Advanced Warrior
War Room Member
 
Jay Rhome's Avatar
 
Join Date: Feb 2009
Posts: 627
Thanks: 154
Thanked 119 Times in 84 Posts
Default WP: Is there a way to automatically update a page with category posts?

In WP, let's say I create a category called "Articles" and make, obviously, POSTS that are articles.

Is there a way to AUTOMATICALLY update a PAGE called "Articles" as well with the links to the new posts in the category?

Thanks
Jay Rhome is offline   Reply With Quote
Old 09-11-2009, 02:58 AM   #2
MinisiteBee.com Designer
War Room Member
 
soffell's Avatar
 
Join Date: Aug 2008
Location: Dieng Plateu
Posts: 523
Blog Entries: 5
Thanks: 129
Thanked 95 Times in 39 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to soffell
Default Re: WP: Is there a way to automatically update a page with category posts?

I think you need to change .php code from theme editor, try in your local computer ir's better

soffell is offline   Reply With Quote
Old 09-11-2009, 07:56 AM   #3
Advanced Warrior
War Room Member
 
Jay Rhome's Avatar
 
Join Date: Feb 2009
Posts: 627
Thanks: 154
Thanked 119 Times in 84 Posts
Default Re: WP: Is there a way to automatically update a page with category posts?

I'm pretty sure too it has to be about adding some PHP code but what code, and how to apply it only to one page, that's what I'm not sure how to do.
Jay Rhome is offline   Reply With Quote
Old 09-11-2009, 08:06 AM   #4
Warrior Member
War Room Member
 
Join Date: Jun 2009
Location: Casa Grande, AZ
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Default Re: WP: Is there a way to automatically update a page with category posts?

Are you using a CMS like wordpress or Joomla? If so, its easier to edit the database (back it up first.)

If it's static html or dynamic php, then yes you could edit the code.
If it's a small site, you could use notepad++ (windows) to open all of the pages at once and make a "find/replace" command across all open pages. that's pretty painless.
zargonoth is offline   Reply With Quote
Old 09-11-2009, 09:56 AM   #5
CGM
Warrior Member
 
Join Date: Sep 2009
Location: Chicagoland, IL
Posts: 6
Thanks: 0
Thanked 3 Times in 3 Posts
Social Networking View Member's Twitter Profile 
Default Re: WP: Is there a way to automatically update a page with category posts?

Heres the code you'll need. In page.php you'll first have to check to see if your on the articles page, then display all the posts of the articles category

Create a blank page first called articles or whatever you want.

In page.php place this code where you want.

<?php
if (($pos = strpos($_SERVER["REQUEST_URI"], 'articles/')) !== false) {

//The Query
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();

$wp_query->query('cat=3'); //CHANGE THIS NUMBER TO THE CATEGORY ID!!!!!!!!!!!!!
global $more;
$more = 0;

if ( $wp_query->have_posts() ) :
while ( $wp_query->have_posts() ) : $wp_query->the_post();
?>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_content('(read more...)'); ?>
<?php
endwhile;
endif;

//Reset Query
$wp_query = null;
$wp_query = $temp;
}
?>

Good luck.

Creative Gray Matter
Web development & design. Specializes in Wordpress, custom plugins, php and mySQL development.
CGM is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Website Design

Tags
automatically, category, page, posts, update

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 07:56 AM.