• Resolved Tranny

    (@tranny)


    If a guy searches for the code to exclude posts from one category from displaying on main page, he will find half million ways of how it will not work. It seems like all programmers go on and on about the same method to exclude a category, but it just doesn’t work. It took a lot of searching to find a way for it to actually work, but unfortunately this method changes the title tag of my page as well. This is the code which DOES exclude a category from displaying:

    <?php if (have_posts()) : ?>
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    <?php query_posts("cat=-1,-91&paged=$paged"); ?>
    <?php while (have_posts()) : the_post(); ?>

    What do i need to do to it so it doesn’t change the Title tag into the same title tag as main page has (my Post Page is NOT Front Page).

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php query_posts( array( 'cat' => '-1,-91' ) ); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    Though I’m not entirely sure what you mean when you say “title tag.”

    Thread Starter Tranny

    (@tranny)

    Hey Greenshady, title tag is the title tag that’s in the head of your site, aka <title> – I always used to refer to it as title tag, not sure what proper name for it is.

    I was able to eventually make it work by modifying functions.php file as per this tutorial, however it’s really frustrating to see how there would be first 20 pages in each search engines full of codes that don’t work. Guy spends hours upon hours messing around with useless codes internet is full of.

    /rant

    ??

    Hi, may I please ask where this code is to be inserted? And what code to delete if this is inserted? It doesn’t seem to work for me. My wp version is 2.8 and I use the template soho-serenity. This is my index.php code below:

    <?php get_header(); ?>

    <?php include(‘sidebar2.php’);?>

    <div id=”container”>
    <div><h3>Updates</h3></div>
    <?php query_posts(‘cat=&showposts=5’); ?>
    <?php $posts = get_posts(‘category=&numberposts=7&offset=0’);
    foreach ($posts as $post) : start_wp(); ?>
    <div class=”entry”>
    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
    <div class=”byline”>
    <?php the_time(__(‘F j, Y’)); ?> <?php edit_post_link(‘Edit’, ‘ | ‘, ”); ?>
    </div>
    <?php the_content(); ?>
    </div>
    <?php endforeach; ?>
    </div>

    <?php include(‘misc.php’);?>
    <?php include(‘bio.php’);?>
    <?php include(‘quote.php’);?>

    <?php get_footer(); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The Only Way to Exclude a Category Busts Title Tag’ is closed to new replies.