• Resolved fanti-c

    (@fanti-c)


    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();

Viewing 6 replies - 1 through 6 (of 6 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You getting a syntax error?

    Thread Starter fanti-c

    (@fanti-c)

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

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    what if you use;

    if ( is_home() ) {
    var_dump("Andrew Nevins");exit;
    query_posts( 'cat=-3' );
    }

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

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

    Thread Starter fanti-c

    (@fanti-c)

    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.

    Thread Starter fanti-c

    (@fanti-c)

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Specific category on the homepage.’ is closed to new replies.