• Resolved dsortax

    (@dsortax)


    Hello, Sorry for my english I will try to explain. I would like my home page to be a category. I know that I can make my home page a static page in options that I’ve created in pages but I would like my homepage to be a category of posts with only specific posts on the home page. Someone can help me with that? Thanks!

    Or either make a page have specific posts on it as the home page.

    In the reading settings > front page display > a static page, I can select a page for the front page but theres no posts on it since it’s a page. How can I make posts on pages?

    Or
    In the reading settings > front page display > a static page, the posts page can be a page but it shows all posts. How can I make a page not have all the posts on it? I mean how can I make the page host only a category of posts?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter dsortax

    (@dsortax)

    I will read that thanks!

    Thread Starter dsortax

    (@dsortax)

    Alright I have read and I want to use that code for my home page showing only one category of posts.

    This is the code on the page you linked:

    Show One Category by Name

    Display posts from only one category by name:

    query_posts('category_name=Staff Home');

    My category name is: One Man Band

    Here is my index.php:

    <?php get_header();?>
    <div style="clear:both;"></div>
            <div id="contentwrap">
                <div id="content">
                    <div id="banner">
                    </div>
    
    <div id="aligner">
    <!-- <div id="fun"></div> -->
    <?php global $wp_query;
    query_posts(
       array_merge(
          $wp_query->query,
          array('orderby' => 'rand')
       )
    );?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                    <div onclick="location.href='<?php the_permalink() ?>';" style="cursor:pointer;background:#<?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?>;" class="post bg thickbox" id="thickbox post-<?php the_ID(); ?>">
                        <div class="bg">
    
                            <div class="posttitle">
                                <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
                            </div>
                        <div>
                                <small>
                                    Album: <?php the_category(', '); ?> |
                                </small>
                            </div>
                           <div align="center" class="entrywhole">
                                <div align="left" class="entry">
                                    <?php post_thumb(); ?><?php the_excerpt('Read more &raquo;'); ?>
                                </div>
                            </div>
                        </div>
                    </div>
    
                    <?php endwhile; ?>
    
                    <?php endif; ?>
             <div style="clear:both;"></div>
                   </div>
    <div align="center" id="navlink">
                        <?php posts_nav_link(); ?>
                    </div>
    
                </div>
    
                <?php get_sidebar();?>
    
            </div>
    
    <?php get_footer();?>

    I have tried to put the code in some places but I always result to a syntax error…

    Can you help me find the right place to put my new code please? Thanks in advance 🙂

    Thread Starter dsortax

    (@dsortax)

    I got it!!! I added this code over the orderby one!

    <?php global $wp_query;
    query_posts(
       array_merge(
          $wp_query->query,
          array('category__in' => array(20))
    )
    );?>

    Had to find out that my array was number 20 for the right category lol. I tried 1,2,3,4 etc.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to make my home page being a category page’ is closed to new replies.