Advertisement
srikat

Untitled

Nov 14th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. // Random background image that changes on page refresh for Front Page 1
  2. add_action( 'wp_head', 'sk_front_page_1_background_image' );
  3. function sk_front_page_1_background_image() {
  4.  
  5. // abort if Soliloquy is not active
  6. if ( ! function_exists( 'soliloquy' ) ) {
  7. return;
  8. }
  9.  
  10. // "display" Front Page 1 slider - i.e., get the URL of random slide image using the soliloquy_output filter used earlier and store it in a variable
  11. $random_slide_image_url = soliloquy( 'front-page-1', 'slug', array(), true );
  12.  
  13. if ( $random_slide_image_url ) { ?>
  14. <style type="text/css">
  15. .front-page-1 {
  16. background-image: url(<?php echo $random_slide_image_url; ?>);
  17. }
  18. </style>
  19. <?php }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement