Display Text Over Image Using Custom Fields
-
I’ve created custom fields for text and need to add a background image to each text field so i’ve created another custom field for the image.
The only problem is, the text displays before or after the image and i need it to display over the image.
$one = get_post_meta( get_the_ID(), 'field_1_text', true ); if( ! empty( $one ) ) { echo '<div class="custom-field-text"><div class="wrap">'. $one .'</div></div>'; } $image_one = get_post_meta( get_the_ID(), 'field_1_image', true ); if( ! empty( $image_one ) ) { echo '<div class="custom-field-image">' . wp_get_attachment_image( $image_one, 'full' ) . '</div>'; }
The template i’m building has 7 areas for custom field content and will be used on dozens of pages on each site.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display Text Over Image Using Custom Fields’ is closed to new replies.