![]() | | ||||||||
| | #1 |
| Advanced Warrior War Room Member Join Date: Feb 2009
Posts: 627
Thanks: 154
Thanked 119 Times in 84 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 |
| | |
| | #2 |
| MinisiteBee.com Designer War Room Member Join Date: Aug 2008 Location: Dieng Plateu
Posts: 523
Blog Entries: 5 Thanks: 129
Thanked 95 Times in 39 Posts
|
I think you need to change .php code from theme editor, try in your local computer ir's better
|
| | |
| | |
| | #3 |
| Advanced Warrior War Room Member Join Date: Feb 2009
Posts: 627
Thanks: 154
Thanked 119 Times in 84 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.
|
| | |
| | #4 |
| Warrior Member War Room Member Join Date: Jun 2009 Location: Casa Grande, AZ
Posts: 12
Thanks: 2
Thanked 0 Times in 0 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. |
| | |
| | #5 |
| Warrior Member Join Date: Sep 2009 Location: Chicagoland, IL
Posts: 6
Thanks: 0
Thanked 3 Times in 3 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. | |
| | |
![]() |
|
| Tags |
| automatically, category, page, posts, update |
| Thread Tools | |
| |
![]() |