• Hi folks,

    So basically I have this problem which is maybe a really small one but my brain’s dead for last couple of weeks for I have been updating my repository…

    I have constructed my front-page so it shows posts from categories I want, due to having to create additional category for the custom content slider I have created my self a problem, when chosen to be in its category and in slider every post on it’s category tag fetches the “slider” category name, so I really need a way to let him fetch the category for the tag but exclude slider one here’s the code:

    <?php $vijest = new WP_Query('showposts=4&cat=1'); while($vijest ->have_posts()) : $vijest->the_post();  ?>
    <?php $category = get_the_category(); ?>
    <div class="post-categories"><a href="#"><?php echo $category[0]->cat_name; ?></a></div>

    So, as You can see I need to some how change this:

    <?php echo $category[0]->cat_name; ?></a></div>

    In which certain category will never be echoed…

    Any thoughts?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m not quite understanding, are you saying that your content slider has one category and that your post is fetching from the slider.

    Thread Starter DinoCSP

    (@dinocsp)

    To clear up a bit, to get my content slider I had to create a category and make condition that if one of post’s selected categories is “slider” it shows up up there, but now when I select that category on certain posts let’s say I have something in the “Music” category and want to display it also in content slider, so I check also “Slider”, now that post has two categories Music and Slider, now I have posts also listed beneath the slider in categories, lets say first block shows last 4 posts from “Music”, and on the post thumbnail there is a tag that says category name, now whenever I point it to Music and Slider inside that block that contains posts from Music category it says on that tag that it is from Slider category, and I need to find a way to force WP to stop showing that category name there but to try to find other (there always is other, because Slider is in this case only a tag-like-category that tells content slider to show certain post)

    Ok i understand what you are saying, you don’t want the category “slider” to show.

    Unfortunately i don’t know how to do that but i hope someone answers because i myself am working on a blog site and for the slider i created i have those set to a category called “featured” but i don’t want the category name “featured” to show in the post so lets hope that someone can figure this out.

    Thread Starter DinoCSP

    (@dinocsp)

    I’ve figured out a way w/o any kind of PHP code, the call for category from above fetches first category it gets, by some stupid logic of mine I realized it is an alphabet order so I renamed this ghost category “Slider” into “zSlider” since it’s first two letters will be alphabetically always at the bottom every other category will be showed before it is. Hope someone finds a way to change it for category under any name!

    Thread Starter DinoCSP

    (@dinocsp)

    The it self is on Bosnian, so don’t be shocked… http://lukavac-x.ba is the uri.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to: Block category from showing’ is closed to new replies.