Advertisement
srikat

Untitled

Mar 21st, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. // Add featured image to posts/pages.
  2. add_action( 'genesis_entry_content', 'spi_do_featured_image', 1 );
  3. function spi_do_featured_image() {
  4.  
  5. // if we are not on a single Post page, abort.
  6. if ( ! is_singular( 'post' ) ) {
  7. return;
  8. }
  9.  
  10. $show_image = get_theme_mod( 'spi_single_image_setting', true );
  11.  
  12. $img = genesis_get_image( array(
  13. 'format' => 'html',
  14. 'size' => genesis_get_option( 'image_size' ),
  15. 'context' => 'archive',
  16. 'attr' => genesis_parse_attr( 'entry-image', array ( 'alt' => get_the_title() ) ),
  17. ) );
  18.  
  19. if ( ! empty( $img ) && ( true === $show_image ) ) {
  20. echo $img;
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement