SRD75

shortcode

Mar 4th, 2021
767
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function carousel_frontend_panel_bgimage($text_slider_testimonial_how_to_bar_title = '',$text_slider_testimonial_how_to_bar_content = '', $text_slider_testimonial_img = '')
  2. {
  3.     global $wpdb, $wp_roles;
  4.     $text_slider_content = '';
  5.     $text_slider_content .= "<div class='text_slider_testimonial' style='background-size: cover; background-image: url('". $text_slider_testimonial_img ."')>";
  6.     $text_slider_content .= '<div class="text_slider_title">';
  7.     $text_slider_content .= $text_slider_testimonial_how_to_bar_title;
  8.     $text_slider_content .= '</div>';
  9.     $text_slider_content .= '</div>';
  10.     $text_slider_content .= "<div class='text_slider_content'>" ;
  11.     $text_slider_content .= $text_slider_testimonial_how_to_bar_content;
  12.     $text_slider_content .= '</div>';
  13.     return $text_slider_content;   
  14. }
  15.  
  16. function carousel_shortcode_large($atts)
  17. {
  18.     global $table_prefix,$wpdb,$post,$theme_dir;
  19.     $post_type_cat = 'text_slider_categories';
  20.  
  21.     $return_content = '';
  22.     $return_content .= '<div class="text_slider_testimonial_panel_large">';
  23.  
  24.     $post_type = 'text_slider';
  25.     $sql = $wpdb->prepare( "SELECT ID, post_title, post_content FROM $wpdb->posts WHERE post_type=%s AND post_status='publish' order by post_title ASC",$post_type);
  26.  
  27.     if ((isset($atts)) && (is_array($atts)) && (count($atts) > 0))
  28.     {
  29.         if (isset($atts['catid']))
  30.         {
  31.             $catid = $atts['catid'];
  32.             $user_args_catid = sanitize_text_field($atts['catid']);
  33.             $user_args_catid_array = explode(",", trim($user_args_catid));
  34.    
  35.             if ((is_array($user_args_catid_array)) && (count($user_args_catid_array) > 0))
  36.             {
  37.                    
  38.                 $user_args_catid_query = implode(',', $user_args_catid_array);
  39.    
  40.                 $sql = "
  41.                 SELECT ID, post_title, post_content
  42.                 FROM $wpdb->posts wposts
  43.                 LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)
  44.                 LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
  45.                 WHERE wposts.post_type = '$post_type'
  46.                 AND post_status='publish'
  47.                 AND $wpdb->term_taxonomy.taxonomy = '$post_type_cat'
  48.                 AND $wpdb->term_taxonomy.term_id IN($user_args_catid_query)
  49.                 ORDER BY wposts.post_title ASC
  50.                 ";
  51.    
  52.             }
  53.         }
  54.     }
  55.    
  56.     $results = $wpdb->get_results( $sql );
  57.  
  58.     if ((!(empty($results))) && (is_array($results)) && (count($results) >0))
  59.     {
  60.         if (isset($atts['catid'])) {
  61.             $catid = $atts['catid'];
  62.         }
  63.         $return_content .= '<div id="carousel-' . $catid . '" class="carousel slide" data-ride="carousel"><div class="carousel-inner">';
  64.         $text_slides = count($results);
  65.         $isFirst = true;
  66.         $i=1;
  67.         foreach ($results as $single)
  68.         {
  69.             $text_slider_testimonial_how_to_bar_title = $single->post_title;
  70.             $text_slider_testimonial_img = get_the_post_thumbnail_url($single->ID);
  71.             echo $text_slider_testimonial_img;
  72.       $original_post = $post;
  73.       $post = get_post($single->ID);
  74.       $text_slider_testimonial_how_to_bar_content = get_the_excerpt($single->ID);
  75.       $post = $original_post;
  76.                
  77.             $text_slider_testimonial_how_to_bar_content = $single->post_content;
  78.  
  79.             if($i==1) {
  80.                 $return_content .= '<div class="carousel-item active">';
  81.                 $return_content .= carousel_frontend_panel_bgimage ( $text_slider_testimonial_how_to_bar_title,$text_slider_testimonial_how_to_bar_content, $text_slider_testimonial_img );
  82.                 $return_content .= '</div>';
  83.             } else {
  84.                 $return_content .= '<div class="carousel-item">';
  85.                 $return_content .= carousel_frontend_panel_bgimage ( $text_slider_testimonial_how_to_bar_title,$text_slider_testimonial_how_to_bar_content, $text_slider_testimonial_img );
  86.                 $return_content .= '</div>';
  87.             }
  88.             $i++;
  89.         }
  90.         $return_content .= '</div>';
  91.         $return_content .= '<ol class="carousel-indicators">';
  92.         $controls = '<li data-target="#carousel-' . $catid . '" data-slide-to=0 class="active"><i class="fas fa-circle"></i></li>';
  93.         for ($i = 2; $i <= $text_slides; $i++) {
  94.                 $controls .= '<li data-target="#carousel-' . $catid . '" data-slide-to=' . ($i - 1) . '><i class="fas fa-circle"></i></li>';
  95.         }
  96.         $return_content .= $controls;
  97.         $return_content .= '</ol>';
  98.     }
  99.  
  100.     $return_content .= '</div>';
  101.     $return_content .= '</div>';
  102.  
  103.     return $return_content;
  104.  
  105. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×