get_post_format & has_post_format problem
-
I hope this is the right place to ask this question. I don’t know much about WP and I really don’t know much about PHP (although I know several other languages) so I’m probably missing something obvious.
Anyway, I want to modify a theme to not output the title for status and photo posts. So at the appropriate place in the theme (yes I use a child theme) I added an if-statement with a
has_post_format
call. Unfortunately, this didn’t work and I started to try to figure out why by usingget_post_format
to see what post format the post have (this is for a single post). I used this snippet (CSS removed)<h1><?php the_title(); ?> XXX <?php get_post_format(); ?> YYY</h1>
And I end up with this output “Current status XXX YYY”. Slightly confused, this post has the “photo” post format not the “standard” format, I changed the line to see if I needed to use the post ID
<h1><?php the_title(); ?> XXX <?php get_post_format(the_ID()); ?> YYY</h1>
And I get “Current status XXX 38 YYY” … which makes me even more confused. What am I missing here?
- The topic ‘get_post_format & has_post_format problem’ is closed to new replies.