Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. <div class="header-image"><?php
  2.  
  3. $image = get_field('imagen_superior');
  4.  
  5. if( !empty($image) ): ?>
  6.  
  7. <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
  8.  
  9. <?php endif; ?></div>
  10.  
  11. function my_image() {
  12.  
  13. $image = get_field('imagen_superior');
  14. if( !empty($image) ) {
  15.  
  16. echo '<img src="' . $image['url'] . '" alt="' . $image['alt'] . '" />';
  17.  
  18. }
  19.  
  20. }
  21.  
  22. function my_shortcode( $attr ) {
  23.  
  24. return '<div class="header-image">' . my_image() . '</div>';
  25.  
  26. }
  27.  
  28. add_shortcode( 'my-shortcode', 'my_shortcode' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement