Inserting Snippets Into Code
-
I’m trying to figure out the (I’m sure simple) task of including a snippet into a page template.
Here is the code I’m trying to add… maybe best as a shortcode? But still unsure how to accomplish it.
<?php $post_object = get_field('location'); if( $post_object ): // override $post $post = $post_object; setup_postdata( $post ); ?> <div> <img src="<?php the_field('new_icon'); ?>" width="151" /></div> <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?> <?php endif; ?>
Thanks for any help.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Inserting Snippets Into Code’ is closed to new replies.