• Is there a way to make the category automatically put itself to the front of a title when you push submit? IE I only type in the title “Pillars of Smurf” and I put it in the category Lend. When I hit submit and go to the blog it shows

    Lend Pillars of Smurf

    instead of just

    Pillars of Smurf.

    Thanks for any help… I really should just learn PHP instead of trying to hack at it hap hazardly. (If only I had the time)

    Bruce

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php the_category(', '); ?>

    in front of your title php

    so for me it would look like:

    <div class="titleText"><?php the_category(', '); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></div>

    Thread Starter audiosq

    (@audiosq)

    Thanks! I guess I’m a little too dumb though. I’ve put it in a couple places around my title tag and I can get it to say the category in random places around the title, but not in the title itself. Here’s the code around the title tag. Where would it go exactly?

    <a href="<?php if(isset($post->post_type)) echo(get_bloginfo('url') . '?post_type=' . $post->post_type); else echo('#'); ?>" class="bubble"><?php the_title(); ?></a>

    Thanks again!

    Bruce

    Thread Starter audiosq

    (@audiosq)

    Ok.. that was the wrong place. I found the code a few lines down and I’ve got it to look like it’s part of the title. The only problem is I want it to be part of the title. As in one link to the post. As of now it’s two seperate links, one to the category and one to the post. The reason I want one is if someone were to retweet the post then I lose the category in front of the title. Is there anyway to make it part of the title? Here’s the code.

    <h<?php if(!is_single()) echo('2'); else echo('1'); ?> class="title"><?php the_category(', '); ?> - <?php if(!is_single()) echo('<a href="'. $link .'">');?><?php the_title(); ?><?php if(!is_single()) echo('</a>'); ?></h<?php if(!is_single()) echo('2'); else echo('1'); ?>>

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Put Category in Title Automatically’ is closed to new replies.