get_post_meta on homepage
-
Hello,
I’ve seen this question in the forums but there doesn’t ever seem to be a universal solution.
I use a meta box in my posts to insert things before/after my title. Everything works fine on single pages, but on the homepage get_post_meta doesn’t return the value.
<?php if ( is_single() || is_home() ) { $beforetitle = get_post_meta($post->ID, 'beforetitle', true); if ( $beforetitle != '' ) { echo $beforetitle; } } ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php if ( is_single() || is_home() ) { $aftertitle = get_post_meta($post->ID, 'aftertitle', true); if ( $aftertitle != '' ) { echo $aftertitle; } } ?>
You can see the homepage: https://signyourbikeout.com and the same post as a single page: https://signyourbikeout.com/2011/08/let%E2%80%99s-move-on-from-inverted-triangle-writing/
The triangle doesn’t show up in the homepage.
I was using if is_home, etc and those calls all returned true. I also tried reset query but it didn’t seem to help
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘get_post_meta on homepage’ is closed to new replies.