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?

  • What's wrong with if (!has_post_format('aside') && !has_post_format('link')) ?
    – cjbj
    May 20, 2016 at 11:02

1 Answer 1



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.

  • 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())... Jan 24, 2013 at 18:45
  • @DeanElliott - please see my updated answer above. Jan 25, 2013 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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