How to add custom fields?
-
I read your answer here: show custom field
But how to add a custom field BEFORE the title?
I want to add the name of the author (for example, Shakespeare, if this is Shakespeare’s verse) BEFORE the code:
esc_attr( get_the_title() );
And to be covered by the link.
I tried to write this:$html .= '<h3 class="rpwe-title"><a href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'recent-posts-widget-extended' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">'; if ( get_post_meta( get_the_ID(), 'creator', true ) ) : $html .= '<p>'; $html .= get_post_meta( get_the_ID(), 'creator', true ); $html .= '</p>'; endif; $html .= '<h3 class="rpwe-title"><a href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'recent-posts-widget-extended' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">'; if ( get_post_meta( get_the_ID(), 'creator', true ) ) : $html .= '<p>'; $html .= get_post_meta( get_the_ID(), 'creator', true ); $html .= '</p>'; endif; esc_attr( get_the_title() );
But it does not work. Help me please.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to add custom fields?’ is closed to new replies.