Dastel
|
How to realize a display only certain categories on the home page? Artisteer 3.0 and Wordpress 3.1. Please help)
|
|
Sarah
|
A simple way to do this without messing with any code is to get the plugin "Page Links To" Create a static home page, and place the link to the desired category for that page to link to. So, when someone clicks on the home button, they will see that category list instead.
Otherwise, you can edit the index.php file to display that category.
|
|
John
|
I tried to insert this code in index.php
"query_posts ('cat =- 25, -26, -27, -28, -29');"
but the submenus do not work anymore.
|
|
Sarah
|
Have you tried using conditional tags instead? That might work better. http://codex.wordpress.org/Conditional_Tags
|
|
Adeptris
|
Locate the loop in index.php!
if (have_posts()){
while (have_posts())
{
//Added by Dastel
if (in_category( array( 'Tropical Birds', 'small-mammals' )) ) return;
HTH
David
|
|
Adeptris
|
That will skip any posts in those categories
http://codex.wordpress.org/Function_Reference/in_category
David
|
|
Alicia
|
I'm sorry I don't quite understand the syntax of where to put the code in order to pull only one category of posts onto the home page.
here is my index.php code:
<?php get_header(); ?>
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell art-sidebar1">
<?php get_sidebar('default'); ?>
<div class="cleared"></div>
</div>
<div class="art-layout-cell art-content">
<?php get_sidebar('top'); ?>
<?php
if(have_posts()) {
/* Display navigation to next/previous pages when applicable */
if ( theme_get_option('theme_' . (theme_is_home() ? 'home_' : '') . 'top_posts_navigation' ) ) {
theme_page_navigation();
}
/* Start the Loop */
while (have_posts()) {
the_post();
get_template_part('content', get_post_format());
}
/* Display navigation to next/previous pages when applicable */
if (theme_get_option('theme_bottom_posts_navigation')) {
theme_page_navigation();
}
} else {
theme_404_content();
}
?>
<?php get_sidebar('bottom'); ?>
<div class="cleared"></div>
</div>
</div>
</div>
<div class="cleared"></div>
<?php get_footer(); ?>
Where exactly do I put the code that will pull from a category (i.e. a category named 'featured')
|
|