kevin.zalaznik
asked 9 years ago

When using the recent posts widget on the home page, I’d like custom fields to be available. To instead of using:

<h2><a href=”<?php the_permalink() ?>” title=”<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>”><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a></h2>

I’d like to

<?php echo get_post_meta($post->ID,’extra_title’,true); ?>

However, this leaves the title area blank.

2 Answers
Jennifer N
answered 9 years ago

Hi Kevin,
Because we do not use global $post in here,   please use get_the_ID() instead of $post->ID,

Let me know if you need further assistance
Regards
Jennifer

Jennifer N
answered 9 years ago

Hi Kevin,
Because we do not use global $post in here,   please use get_the_ID() instead of $post->ID,

Let me know if you need further assistance
Regards
Jennifer

Powered by DW Question & Answer Pro