WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Specific category on the homepage. (7 posts)

  1. fanti-c
    Member
    Posted 1 year ago #

    Hello everyone,

    I need some help making my homepage showing specific category. I have tried using the query_posts provided on the codex page but it is not working for me.

    Here is the index.php. What am I doing wrong?
    <?php if (have_posts()) : ?>
    <?php kippis_content_nav('nav-above'); ?>
    <?php
    while (have_posts()) {
    the_post();
    get_template_part('content',get_post_format());
    $kippis_the_first_post = false;
    }
    ?>
    <?php kippis_content_nav('nav-below'); ?>
    <?php else : ?>
    <header><h1><?php _e('Nothing Found','kippis'); ?></h1></header>
    <div id="post-0" class="article post no-results not-found">
    <p><?php _e('Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.','kippis'); ?></p>
    <?php get_search_form(); ?>
    </div><!-- article -->
    <?php endif; ?>
    <?php wp_link_pages(); ?>
    </div>
    <?php
    if ($kippis_is_smartphone) get_sidebar('left');
    get_sidebar('right');
    get_footer();

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    You getting a syntax error?

  3. fanti-c
    Member
    Posted 1 year ago #

    When I paste this code on the top, nothing happens
    <?php
    if ( is_home() ) {
    query_posts( 'cat=-3' );
    }
    ?>

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    what if you use;

    if ( is_home() ) {
    var_dump("Andrew Nevins");exit;
    query_posts( 'cat=-3' );
    }
  5. Aaron
    Member
    Posted 1 year ago #

    Have you tried any plugins? There are a bunch to do this.

    http://wordpress.org/extend/plugins/frontpage-manager/

  6. fanti-c
    Member
    Posted 1 year ago #

    this is the whole code. sorry
    <?php
    get_header();
    if (!$kippis_is_smartphone) get_sidebar('left');
    $kippis_the_first_post = true;
    ?>
    <div id="content">
    <?php if (have_posts()) : ?>
    <?php kippis_content_nav('nav-above'); ?>
    <?php
    while (have_posts()) {
    the_post();
    get_template_part('content',get_post_format());
    $kippis_the_first_post = false;
    }
    ?>
    <?php kippis_content_nav('nav-below'); ?>
    <?php else : ?>
    <header><h1><?php _e('Nothing Found','kippis'); ?></h1></header>
    <div id="post-0" class="article post no-results not-found">
    <p><?php _e('Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.','kippis'); ?></p>
    <?php get_search_form(); ?>
    </div><!-- article -->
    <?php endif; ?>
    <?php wp_link_pages(); ?>
    </div>
    <?php
    if ($kippis_is_smartphone) get_sidebar('left');
    get_sidebar('right');
    get_footer();

    the first one I posted gives a syntax error, yes.

  7. fanti-c
    Member
    Posted 1 year ago #

    Thank you very much guys! You dont know how happy I am. Have a great day! Bless you!

Topic Closed

This topic has been closed to new replies.

About this Topic