Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to add a post title to all of my posts apart from those that are marked as "aside" or "link" post formats.

I'm currently using this code to hide the post title for aside posts;

<?php if (! has_post_format('aside')) { ?>

    <?php the_title();?>

<?php } ?>

How can I target the "link" post format aswell using this method?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Edited:

Now that I understand your question, try this...

Place this above your title to enable the post_class function.

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

Then add </div> below your title (or excerpt, or wherever you want this special styling to end).

Now, a special class will be added in which you can use the classes for post formats. for example, you may now use .format-aside in your CSS to style the aside.

share|improve this answer
    
That's not really practical for this as the rest of the post is styled the same, I just want to remove the titles from those 2 formats. Surely there's a way to combine 2 post formats using if (! has_post_format())... –  Dean Elliott Jan 24 '13 at 18:45
    
@DeanElliott - please see my updated answer above. –  AndrettiMilas Jan 25 '13 at 19:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.