• Hello,

    I have a question regarding, how can I customize the title of some of my categories?

    E.G.

    I have in my site categories from A to Z (A,B,C,D,E…)

    In those categories I have artists by name, E.G.
    In “A” I have “Jennifer Aniston”, ok? same thing for the others.

    Now, in my main page (INDEX) I only have “News” I mean, I only display a specific category, in this case “News”.

    What I wish to do is to agregate some text to the A to Z category titles, without affecting the “News” categories titles.

    E.G.
    In the “A” category:
    What does “the_title” did before she was famous

    But if I edit the single.php to do that, I affect my “News” titles too. I think just need some code there so I only affect the A to Z category titles.

    My site is: http://www.antesdelafama.com

    Please I need some advice.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Maybe custom templates, don’t know if the following plugin works, but try it:
    http://dev.wp-plugins.org/browser/post-templates/trunk/post-templates.php

    Thread Starter antesdelafama

    (@antesdelafama)

    Thank you Zoutesnor, that plugin might do the trick, but it has 2 years old and it didn´t worked to well with WP 2.0.5

    I´m looking for a piece of code that might exlcude the “News” category from using the custom title. E.G.

    This is what I want to use in single.php

    ¿Qué hacía <?php the_title(); ?> antes de la fama?

    But at the same time I don´t want the “News” category to use that custom title, I just wanted to use the <?php the_title(); ?>

    So I think that somebody that knows a little PHP could help me with some code to use some “IF this then do THAT”

    Thanks!

    http://codex.wordpress.org/Conditional_Tags
    Try the if !is_catgeory(XX) or something like that (I am not a coder…)
    ! = NOT
    XX = your cat ID#

    Thread Starter antesdelafama

    (@antesdelafama)

    Ok, I´m not a coder at all, I´m looking for help outside this forum too.

    I came up with this :S

    <?php if (is_catgeory (1)) != NOT the_title(); ?>

    Of course is not working, the thing should be like this:

    If category = 1 then the_title else ¿Qué hacía the_title antes de la fama?

    Explained:
    If the category is the #1 then I want the normal title, but if is not, then show me the custom title.

    Thanks moshu for the guide though.

    Thread Starter antesdelafama

    (@antesdelafama)

    What about this?

    <?php if (‘is_catgeory’ (1)) != the_title(): ?>
    <?php else : ?>
    ¿Qué hacía <?php the_title(); ?> antes de la fama?
    <?php endif; ?>

    OK, my usual mispelling: category, not catgeory 🙂
    Sorry.
    And the [!] should go where I put it: before the is_category, I guess.

    <?php if(!is_category('1')) : ?>
    do whatever has to be done
    <?php else: ?>
    do some other stuff
    <?php endif; ?>

    That’s the basic syntax – don’t ask me how to fill those “do this” lines 🙂

    Thread Starter antesdelafama

    (@antesdelafama)

    Ok, I did this:

    <?php if(!is_category(‘1’)) : ?>
    <?php the_title(); ?>
    <?php else: ?>
    ¿Qué hacía <?php the_title(); ?> antes de la fama?
    <?php endif; ?>

    But it shows me always <?php the_title(); ?>

    As you said, I need to figure it out how to fill those “do this” lines. We are getting there.

    Shouldn’t that be the other way around???
    When it is NOT category 1 – show the spanish text and else (=when it is cat 1) show the title.

    <?php if(!is_category('1')) : ?>
    ¿Qué hacía <?php the_title(); ?> antes de la fama?
    <?php else: ?>
    <?php the_title(); ?>
    <?php endif; ?>

    Thread Starter antesdelafama

    (@antesdelafama)

    Yeah, you are right, but that only prints the normal title. A friend told me to use this, but it needs more work.

    <?php if ( is_category(‘1’) == true) {
    ¿Qué hacía <?php the_title(); ?> antes de la fama?
    <?php else: ?>
    <?php the_title(); ?>
    }

    But something stills wrong there…

    Thread Starter antesdelafama

    (@antesdelafama)

    This is more refined, It shows no error, but is not doing what I want it just prints the normal title.

    <?php
    if ( is_category(‘1’) == true) {
    print “¿Qué hacía ” . the_title() . ” antes de la fama?”;
    } else {
    print “” . the_title() . “”;
    }
    ?>

    It should be like this:

    <?php if(in_category(1)) : ?>
    ¿Qué hacía <?php the_title() ?> antes de la fama?
    <?php else : ?>
    <?php the_title() ?>
    <?php endif; ?>

    Thread Starter antesdelafama

    (@antesdelafama)

    Damn it! it doesn´t work.

    Let see, if I do this:
    <?php if(in_category(1)) : ?>
    <?php the_title() ?>
    <?php else : ?>
    ¿Qué hacía <?php the_title() ?> antes de la fama?
    <?php endif; ?>

    It works, but also puts the custom TITLE in category 1.

    Oh man, I thought I would be easy, but thanks for the help.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Custom title for specific categories’ is closed to new replies.