Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function carousel_frontend_panel_bgimage($text_slider_testimonial_how_to_bar_title = '',$text_slider_testimonial_how_to_bar_content = '', $text_slider_testimonial_img = '')
- {
- global $wpdb, $wp_roles;
- $text_slider_content = '';
- $text_slider_content .= "<div class='text_slider_testimonial' style='background-size: cover; background-image: url('". $text_slider_testimonial_img ."')>";
- $text_slider_content .= '<div class="text_slider_title">';
- $text_slider_content .= $text_slider_testimonial_how_to_bar_title;
- $text_slider_content .= '</div>';
- $text_slider_content .= '</div>';
- $text_slider_content .= "<div class='text_slider_content'>" ;
- $text_slider_content .= $text_slider_testimonial_how_to_bar_content;
- $text_slider_content .= '</div>';
- return $text_slider_content;
- }
- function carousel_shortcode_large($atts)
- {
- global $table_prefix,$wpdb,$post,$theme_dir;
- $post_type_cat = 'text_slider_categories';
- $return_content = '';
- $return_content .= '<div class="text_slider_testimonial_panel_large">';
- $post_type = 'text_slider';
- $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);
- if ((isset($atts)) && (is_array($atts)) && (count($atts) > 0))
- {
- if (isset($atts['catid']))
- {
- $catid = $atts['catid'];
- $user_args_catid = sanitize_text_field($atts['catid']);
- $user_args_catid_array = explode(",", trim($user_args_catid));
- if ((is_array($user_args_catid_array)) && (count($user_args_catid_array) > 0))
- {
- $user_args_catid_query = implode(',', $user_args_catid_array);
- $sql = "
- SELECT ID, post_title, post_content
- FROM $wpdb->posts wposts
- LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)
- LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
- WHERE wposts.post_type = '$post_type'
- AND post_status='publish'
- AND $wpdb->term_taxonomy.taxonomy = '$post_type_cat'
- AND $wpdb->term_taxonomy.term_id IN($user_args_catid_query)
- ORDER BY wposts.post_title ASC
- ";
- }
- }
- }
- $results = $wpdb->get_results( $sql );
- if ((!(empty($results))) && (is_array($results)) && (count($results) >0))
- {
- if (isset($atts['catid'])) {
- $catid = $atts['catid'];
- }
- $return_content .= '<div id="carousel-' . $catid . '" class="carousel slide" data-ride="carousel"><div class="carousel-inner">';
- $text_slides = count($results);
- $isFirst = true;
- $i=1;
- foreach ($results as $single)
- {
- $text_slider_testimonial_how_to_bar_title = $single->post_title;
- $text_slider_testimonial_img = get_the_post_thumbnail_url($single->ID);
- echo $text_slider_testimonial_img;
- $original_post = $post;
- $post = get_post($single->ID);
- $text_slider_testimonial_how_to_bar_content = get_the_excerpt($single->ID);
- $post = $original_post;
- $text_slider_testimonial_how_to_bar_content = $single->post_content;
- if($i==1) {
- $return_content .= '<div class="carousel-item active">';
- $return_content .= carousel_frontend_panel_bgimage ( $text_slider_testimonial_how_to_bar_title,$text_slider_testimonial_how_to_bar_content, $text_slider_testimonial_img );
- $return_content .= '</div>';
- } else {
- $return_content .= '<div class="carousel-item">';
- $return_content .= carousel_frontend_panel_bgimage ( $text_slider_testimonial_how_to_bar_title,$text_slider_testimonial_how_to_bar_content, $text_slider_testimonial_img );
- $return_content .= '</div>';
- }
- $i++;
- }
- $return_content .= '</div>';
- $return_content .= '<ol class="carousel-indicators">';
- $controls = '<li data-target="#carousel-' . $catid . '" data-slide-to=0 class="active"><i class="fas fa-circle"></i></li>';
- for ($i = 2; $i <= $text_slides; $i++) {
- $controls .= '<li data-target="#carousel-' . $catid . '" data-slide-to=' . ($i - 1) . '><i class="fas fa-circle"></i></li>';
- }
- $return_content .= $controls;
- $return_content .= '</ol>';
- }
- $return_content .= '</div>';
- $return_content .= '</div>';
- return $return_content;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement