Posted By

imtiedup on 04/20/13


Tagged

woocommerce


Versions (?)

woo featured-slider.php


 / Published in: PHP
 

This is the standard woothemes slider code. Working on changing the embed code to use oEmbed instead.

  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) exit;
  3. /**
  4.  * Featured Slider Template
  5.  *
  6.  * Here we setup all HTML pertaining to the featured slider.
  7.  *
  8.  * @package WooFramework
  9.  * @subpackage Template
  10.  */
  11.  
  12. /* Retrieve the settings and setup query arguments. */
  13. $settings = array(
  14. 'featured_entries' => '3',
  15. 'featured_order' => 'DESC',
  16. 'featured_slide_group' => '0',
  17. 'featured_videotitle' => 'true'
  18. );
  19.  
  20. $settings = woo_get_dynamic_values( $settings );
  21.  
  22. $query_args = array(
  23. 'limit' => $settings['featured_entries'],
  24. 'order' => $settings['featured_order'],
  25. 'term' => $settings['featured_slide_group']
  26. );
  27.  
  28. /* Retrieve the slides, based on the query arguments. */
  29. $slides = woo_featured_slider_get_slides( $query_args );
  30.  
  31. /* Media settings */
  32. $media_settings = array( 'width' => '1140', 'height' => '464' );
  33.  
  34. if ( 'true' != $settings['featured_videotitle'] ) {
  35. $media_settings['width'] = '1140';
  36. $media_settings['height'] = '464';
  37. }
  38.  
  39. /* Begin HTML output. */
  40. if ( false != $slides ) {
  41. $count = 0;
  42.  
  43. $container_css_class = 'flexslider';
  44.  
  45. if ( 'true' == $settings['featured_videotitle'] ) {
  46. $container_css_class .= ' default-width-slide';
  47. } else {
  48. $container_css_class .= ' full-width-slide';
  49. }
  50. ?>
  51. <div id="featured-slider" class="flexslider <?php echo esc_attr( $container_css_class ); ?>">
  52. <div class="col-full">
  53. <ul class="slides">
  54. <?php
  55. foreach ( $slides as $k => $post ) {
  56. setup_postdata( $post );
  57. $count++;
  58.  
  59. $url = get_post_meta( get_the_ID(), 'url', true );
  60. $title = get_the_title();
  61. if ( $url != '' ) {
  62. $title = '<a href="' . esc_url( $url ) . '" title="' . esc_attr( $title ) . '">' . $title . '</a>';
  63. }
  64.  
  65. $css_class = 'slide-number-' . esc_attr( $count );
  66.  
  67. $slide_media = '';
  68. $embed = woo_embed( 'width=' . intval( $media_settings['width'] ) . '&height=' . intval( $media_settings['height'] ) . '&class=slide-video' );
  69. $image = woo_image( 'width=1140&noheight=true&class=slide-image&link=img&return=true' );
  70. $content = do_shortcode( get_the_content() );
  71. if ( '' != $embed && '' != $image ) {
  72. $css_class = ' has-video-and-image';
  73. $slide_media = $image . $embed;
  74. } elseif ( '' != $embed ) {
  75. $css_class .= ' has-video';
  76. $slide_media = $embed;
  77. } else {
  78. if ( '' != $image ) {
  79. $css_class .= ' has-image no-video';
  80. $slide_media = $image;
  81. } else {
  82. $css_class .= ' no-image';
  83. $content = do_shortcode( get_the_content() );
  84. }
  85. }
  86. ?>
  87. <li class="slide <?php echo esc_attr( $css_class ); ?>">
  88. <?php
  89. if ( '' != $slide_media ) {
  90. echo '<div class="slide-media">' . $slide_media . '</div><!--/.slide-media-->' . "\n";
  91. }
  92. ?>
  93. <?php if ( '' == $embed || ( '' != $embed && 'true' == $settings['featured_videotitle'] ) ) { ?>
  94. <div class="slide-content">
  95. <header><h1><?php echo $title; ?></h1></header>
  96. <div class="entry"><?php the_content(); ?></div><!--/.entry-->
  97. </div><!--/.slide-content-->
  98. <?php } ?>
  99. </li>
  100. <?php } wp_reset_postdata(); ?>
  101. </ul>
  102. </div><!--/.col-full-->
  103. </div><!--/#featured-slider-->
  104. <?php
  105. } else {
  106. echo do_shortcode( '[box type="info"]' . __( 'Please add some slides in the WordPress admin to show in the Featured Slider.', 'woothemes' ) . '[/box]' );
  107. }
  108. ?>

Report this snippet  

You need to login to post a comment.