WordPress.org

Ready to get started?Download WordPress

Forums

Figuring out how to exclude/include cats on front page (10 posts)

  1. kismetdesign
    Member
    Posted 3 years ago #

    Hi there. I have an issue with the content on the front page of a site I'm helping out on...

    We have a slideshow on the front page that we want to keep. However, the slideshow is set up to pull images from a certain category 'featured gallery'. We want the images and slideshow to show up on the front page, but not the actual posts themselves. See here

    What we want on that front page (for right now) is just the 'About Us' category, and we want it to display the full post for that category, not just the excerpt.

    Can you help with figuring this out?

    Thank you!
    Sarah Peterson

  2. vtxyzzy
    Member
    Posted 3 years ago #

    Make a copy of loop.php and name it loop-index.php. Then, near the front of the file, change this:

    * @package WordPress
     * @subpackage Obscure
     */
    ?>
    
    <?php /* If there are no posts to display, such as an empty archive page */ ?>

    to this:

    * @package WordPress
     * @subpackage Obscure
     */
    ?>
    $term = get_term_by('name','Featured Gallery','category');
    query_posts(array_merge($wp_query->query,
       array('category__not_in' => $term->term_id));
    
    <?php /* If there are no posts to display, such as an empty archive page */ ?>

    Make sure that 'Featured Gallery' is your actual category name.

  3. kismetdesign
    Member
    Posted 3 years ago #

    I just changed it exactly as you said above, and uploaded the loop-index.php.

    It didn't do anything, except for show the code under the gallery on the front page.

    :-/

  4. vtxyzzy
    Member
    Posted 3 years ago #

    Sorry, when I pasted in the code, I omitted the opening and closing php tags. Please try this:

    * @package WordPress
     * @subpackage Obscure
     */
    ?>
    <?php
    $term = get_term_by('name','Featured Gallery','category');
    query_posts(array_merge($wp_query->query,
       array('category__not_in' => $term->term_id));
    ?>
    <?php /* If there are no posts to display, such as an empty archive page */ ?>

    As an alternative, look into the Simply Exclude plugin.

  5. kismetdesign
    Member
    Posted 3 years ago #

    Well that was strange! As soon as I put that code in and then FTP'd it up, the front page of my site said, "PLEASE DO NOT ALTER THE FOOTER".

    Strange. ???

  6. vtxyzzy
    Member
    Posted 3 years ago #

    No idea what that is all about!

  7. kismetdesign
    Member
    Posted 3 years ago #

    I'm thinking that it is because I realized after I spent many hours customizing this 'free' template, there is a copyright on the footer that I have to pay to get rid of. It still says that the template is free, but to get the template creator's links off the bottom of the template, it's 35.00.

    I was planning on paying the 35.00 anyway, because I built this website for a charity in Haiti.

    My guess is that since the code you gave me is up near the top of the index-loop page, it might have altered info further down associated with the footer.

    I see some code that says it's just for the gallery section of my website. I'm not sure how to read it... I can figure out some PHP, but not much. I'll take a screenshot of just that section and attach it. Like I said, I just want the gallery pics to show up (inside the gallery) but not the posts below them. I just want the full post for my 'About Us' category to show below the gallery.

    Here it is

  8. vtxyzzy
    Member
    Posted 3 years ago #

    Please try the plugin before we try to modify code further.

  9. kismetdesign
    Member
    Posted 3 years ago #

    What plugin?

  10. kismetdesign
    Member
    Posted 3 years ago #

    Oh, I see it. Okay.

Topic Closed

This topic has been closed to new replies.

About this Topic