</a></h2> <?php } else { ?> <h1 class="post-title"><?php the_title(); ?> </h1> <?php } ?> </header> <?php $random = gener_random(10); ?> <script type="text/javascript"> // Can also be used with $(document).ready() $(window).load(function() { $('#flexslider_<?php echo $random; ?> ').flexslider({ animation: "slide", smoothHeight: true }); }); </script>
function shortcode_post_cycle($atts, $content = null, $shortcodename = '') { extract(shortcode_atts(array('num' => '5', 'type' => 'post', 'meta' => '', 'effect' => 'slide', 'thumb' => 'true', 'thumb_width' => '200', 'thumb_height' => '180', 'more_text_single' => '', 'category' => '', 'custom_category' => '', 'excerpt_count' => '15', 'pagination' => 'true', 'navigation' => 'true', 'custom_class' => ''), $atts)); $type_post = $type; $slider_pagination = $pagination; $slider_navigation = $navigation; $random = gener_random(10); $i = 0; $rand = rand(); $count = 0; if (is_rtl()) { $is_rtl = 'true'; } else { $is_rtl = 'false'; } $output = '<script type="text/javascript"> jQuery(window).load(function() { jQuery("#flexslider_' . $random . '").flexslider({ animation: "' . $effect . '", smoothHeight : true, directionNav: ' . $slider_navigation . ', controlNav: ' . $slider_pagination . ', rtl: ' . $is_rtl . ' }); });'; $output .= '</script>'; $output .= '<div id="flexslider_' . $random . '" class="flexslider no-bg ' . $custom_class . '">'; $output .= '<ul class="slides">'; global $post; global $my_string_limit_words; // WPML filter $suppress_filters = get_option('suppress_filters'); $args = array('post_type' => $type_post, 'category_name' => $category, $type_post . '_category' => $custom_category, 'numberposts' => $num, 'orderby' => 'post_date', 'order' => 'DESC', 'suppress_filters' => $suppress_filters); $latest = get_posts($args); foreach ($latest as $key => $post) { //Check if WPML is activated if (defined('ICL_SITEPRESS_VERSION')) { global $sitepress; $post_lang = $sitepress->get_language_for_element($post->ID, 'post_' . $type_post); $curr_lang = $sitepress->get_current_language(); // Unset not translated posts if ($post_lang != $curr_lang) { unset($latest[$key]); } // Post ID is different in a second language Solution if (function_exists('icl_object_id')) { $post = get_post(icl_object_id($post->ID, $type_post, true)); } } setup_postdata($post); $excerpt = get_the_excerpt(); $attachment_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $url = $attachment_url['0']; $image = aq_resize($url, $thumb_width, $thumb_height, true); $output .= '<li class="list-item-' . $count . '">'; if ($thumb == 'true') { if (has_post_thumbnail($post->ID)) { $output .= '<figure class="thumbnail featured-thumbnail">'; $output .= '<img src="' . $image . '" alt="' . get_the_title($post->ID) . '" />'; $output .= '</figure>'; } else { $thumbid = 0; $thumbid = get_post_thumbnail_id($post->ID); $images = get_children(array('orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1)); if ($images) { $k = 0; //looping through the images foreach ($images as $attachment_id => $attachment) { // $prettyType = "prettyPhoto-".$rand ."[gallery".$i."]"; //if( $attachment->ID == $thumbid ) continue; $image_attributes = wp_get_attachment_image_src($attachment_id, 'full'); // returns an array $img = aq_resize($image_attributes[0], $thumb_width, $thumb_height, true); //resize & crop img $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); $image_title = $attachment->post_title; if ($k == 0) { $output .= '<figure class="featured-thumbnail">'; $output .= '<a href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; $output .= '<img src="' . $img . '" alt="' . get_the_title($post->ID) . '" />'; $output .= '</a></figure>'; } break; $k++; } } } } // post category $output .= '<span class="post_category">'; if ($type != '' && $type != 'post') { $terms = get_the_terms($post_id, $type . '_category'); if ($terms && !is_wp_error($terms)) { $out = array(); foreach ($terms as $term) { $out[] = '<a href="' . get_term_link($term->slug, $type . '_category') . '">' . $term->name . '</a>'; } $output .= join(', ', $out); } } else { $categories = get_the_category($post_id); if ($categories) { $out = array(); foreach ($categories as $category) { $out[] = '<a href="' . get_category_link($category->term_id) . '" title="' . $category->name . '">' . $category->cat_name . '</a> '; } $output .= join(', ', $out); } } $output .= '</span>'; $output .= '<div class="caption">'; if ($meta == 'true') { $output .= '<span class="meta">'; $output .= '<span class="post-date">'; $output .= get_the_date('j F, h:i'); $output .= '</span>'; $output .= '<span class="post_count">'; $output .= $icon_tips_before . custom_getPostViews($post->ID) . $icon_tips_after; $output .= '</span>'; $output .= '<span class="post-comments">'; $output .= '<a href="' . get_comments_link($post->ID) . '">'; $output .= get_comments_number($post->ID); $output .= '</a>'; $output .= '</span>'; $post_ID = get_the_ID(); $post_type = get_post_type($post_ID); $icon_tips_before = $post_meta_type == 'icon' ? '<div class="tips">' : ''; $icon_tips_after = $post_meta_type == 'icon' ? '</div>' : ''; $user_login = is_user_logged_in() ? true : false; $user_id = $user_login ? get_current_user_id() : ""; $voting_class = $user_login ? 'ajax_voting ' : 'not_voting '; $voting_url = PARENT_URL . '/includes/voting.php?post_ID=' . $post_ID . '&get_user_ID=' . $user_id; $get_voting_array = cherry_getPostVoting($post_ID, $user_id); $user_voting = $get_voting_array['user_voting']; $like_url = $user_login && $user_voting == 'none' ? 'href="' . $voting_url . '&voting=like"' : ''; $like_count = $get_voting_array['like_count']; $like_title = $user_login ? theme_locals('like') : theme_locals('not_voting'); $like_class = $user_voting == 'like' ? 'user_like ' : ''; if ($user_voting != 'none') { $voting_class = "user_voting "; } $output .= '<span class="post_like">'; $output .= '<a ' . $like_url . ' class="' . $voting_class . $like_class . '" title="' . $like_title . '" date-type="like" >'; $output .= '<i class="icon-thumbs-up"></i>'; $output .= $icon_tips_before . '<span class="voting_count">' . $like_count . '</span>' . $icon_tips_after; $output .= '</a>'; $output .= '</span>'; $output .= '</span>'; } //display post options $output .= '<div class="post_options">'; switch ($type_post) { case "team": $teampos = get_post_meta($post->ID, 'my_team_pos', true); $team_email = sanitize_email(get_post_meta($post->ID, 'my_team_email', true)); $teaminfo = get_post_meta($post->ID, 'my_team_info', true); if (!empty($teampos)) { $output .= "<span class='page-desc'>" . $teampos . "</span><br>"; } if (!empty($team_email) && is_email($team_email)) { $output .= '<span class="team-email"><a href="mailto:' . antispambot($team_email, 1) . '">' . antispambot($team_email) . ' </a></span><br>'; } if (!empty($teaminfo)) { $output .= '<span class="team-content post-content team-info">' . esc_html($teaminfo) . '</span>'; } $output .= cherry_get_post_networks(array('post_id' => $post->ID, 'display_title' => false, 'output_type' => 'return')); break; case "testi": $testiname = get_post_meta($post->ID, 'my_testi_caption', true); $testiurl = esc_url(get_post_meta($post->ID, 'my_testi_url', true)); $testiinfo = get_post_meta($post->ID, 'my_testi_info', true); $testiemail = sanitize_email(get_post_meta($post->ID, 'my_testi_email', true)); if (!empty($testiname)) { $output .= '<span class="user">' . $testiname . '</span>, '; } if (!empty($testiinfo)) { $output .= '<span class="info">' . $testiinfo . '</span><br>'; } if (!empty($testiurl)) { $output .= '<a class="testi-url" href="' . $testiurl . '" target="_blank">' . $testiurl . '</a><br>'; } if (!empty($testiemail) && is_email($testiemail)) { $output .= '<a class="testi-email" href="mailto:' . antispambot($testiemail, 1) . '">' . antispambot($testiemail) . ' </a>'; } break; case "portfolio": $portfolioClient = get_post_meta($post->ID, 'tz_portfolio_client', true) ? get_post_meta($post->ID, 'tz_portfolio_client', true) : ""; $portfolioDate = get_post_meta($post->ID, 'tz_portfolio_date', true) ? get_post_meta($post->ID, 'tz_portfolio_date', true) : ""; $portfolioInfo = get_post_meta($post->ID, 'tz_portfolio_info', true) ? get_post_meta($post->ID, 'tz_portfolio_info', true) : ""; $portfolioURL = get_post_meta($post->ID, 'tz_portfolio_url', true) ? get_post_meta($post->ID, 'tz_portfolio_url', true) : ""; $output .= "<strong class='portfolio-meta-key'>" . __('Client', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioClient . "</span><br>"; $output .= "<strong class='portfolio-meta-key'>" . __('Date', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioDate . "</span><br>"; $output .= "<strong class='portfolio-meta-key'>" . __('Info', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioInfo . "</span><br>"; $output .= "<a href='" . $portfolioURL . "'>" . __('Launch Project', CHERRY_PLUGIN_DOMAIN) . "</a><br>"; break; default: $output .= ""; } $output .= '</div>'; $output .= '<h5><a href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; $output .= get_the_title($post->ID); $output .= '</a></h5>'; if ($excerpt_count >= 1) { $output .= '<p class="excerpt">'; $output .= my_string_limit_words($excerpt, $excerpt_count); $output .= '</p>'; } if ($more_text_single != "") { $output .= '<a href="' . get_permalink($post->ID) . '" class="btn btn-primary" title="' . get_the_title($post->ID) . '">'; $output .= $more_text_single; $output .= '</a>'; } $output .= '</div>'; $output .= '</li>'; $count++; } wp_reset_postdata(); // restore the global $post variable $output .= '</ul>'; $output .= '</div>'; $output = apply_filters('cherry_plugin_shortcode_output', $output, $atts, $shortcodename); return $output; }
function tz_gallery($postid, $imagesize) { ?> <?php $random = gener_random(10); ?> <script type="text/javascript"> jQuery(window).load(function() { jQuery('#flexslider_<?php echo $random; ?> ').flexslider({ animation: "slide", smoothHeight : true <?php if (is_rtl()) { ?> ,rtl : true <?php } ?> }); }); </script> <div id="flexslider_<?php echo $random; ?> " class="flexslider thumbnail"> <ul class="slides"> <?php $args = array('orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => get_the_ID(), 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1); $attachments = get_posts($args); $lightbox = get_post_meta(get_the_ID(), 'tz_image_lightbox', TRUE); if ($lightbox == 'yes') { $lightbox = TRUE; } else { $lightbox = FALSE; } $src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), array('9999', '9999'), false, ''); if ($attachments) { foreach ($attachments as $attachment) { $attachment_url = wp_get_attachment_image_src($attachment->ID, 'full'); $url = $attachment_url['0']; $image = aq_resize($url, 650, 400, true); ?> <li> <?php if ($lightbox) { ?> <a href="<?php echo $attachment_url['0']; ?> " class="image-wrap" rel="prettyPhoto[gallery]"> <img src="<?php echo $image; ?> " alt="<?php echo apply_filters('the_title', $attachment->post_title); ?> "/> <span class="zoom-icon"></span> </a> <?php } else { ?> <img src="<?php echo $image; ?> " alt="<?php echo apply_filters('the_title', $attachment->post_title); ?> "/> <?php } ?> </li> <?php } ?> <?php } ?> </ul> </div> <?php }
function shortcode_post_cycle($atts, $content = null) { extract(shortcode_atts(array( 'num' => '5', 'type' => '', 'meta' => '', 'effect' => 'slide', 'thumb' => 'true', 'thumb_width' => '200', 'thumb_height' => '180', 'more_text_single' => theme_locals('read_more'), 'category' => '', 'custom_category' => '', 'excerpt_count' => '15', 'pagination' => 'true', 'navigation' => 'true', 'custom_class' => '' ), $atts)); $type_post=$type; $slider_pagination=$pagination; $slider_navigation=$navigation; $random = gener_random(10); $output = '<script type="text/javascript"> $(window).load(function() { $("#flexslider_'.$random.'").flexslider({ animation: "'.$effect.'", smoothHeight : true, directionNav: '.$slider_navigation.', controlNav: '.$slider_pagination.' }); });'; $output .= '</script>'; $output .= '<div id="flexslider_'.$random.'" class="flexslider no-bg '.$custom_class.'">'; $output .= '<ul class="slides">'; global $post; global $my_string_limit_words; $args = array( 'post_type' => $type_post, 'category_name' => $category, $type_post . '_category' => $custom_category, 'numberposts' => $num, 'orderby' => 'post_date', 'order' => 'DESC' ); $latest = get_posts($args); foreach($latest as $post) { setup_postdata($post); $excerpt = get_the_excerpt(); $attachment_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); $url = $attachment_url['0']; $image = aq_resize($url, $thumb_width, $thumb_height, true); $output .= '<li>'; if ($thumb == 'true') { if ( has_post_thumbnail($post->ID) ){ $output .= '<figure class="thumbnail featured-thumbnail"><a href="'.get_permalink($post->ID).'" title="'.get_the_title($post->ID).'">'; $output .= '<img src="'.$image.'" alt="'.get_the_title($post->ID).'" />'; $output .= '</a></figure>'; } else { $thumbid = 0; $thumbid = get_post_thumbnail_id($post->ID); $images = get_children( array( 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1 ) ); if ( $images ) { $k = 0; //looping through the images foreach ( $images as $attachment_id => $attachment ) { $prettyType = "prettyPhoto[gallery".$i."]"; //if( $attachment->ID == $thumbid ) continue; $image_attributes = wp_get_attachment_image_src( $attachment_id, 'full' ); // returns an array $img = aq_resize( $image_attributes[0], $thumb_width, $thumb_height, true ); //resize & crop img $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); $image_title = $attachment->post_title; if ( $k == 0 ) { $output .= '<figure class="featured-thumbnail">'; $output .= '<a href="'.get_permalink($post->ID).'" title="'.get_the_title($post->ID).'">'; $output .= '<img src="'.$img.'" alt="'.get_the_title($post->ID).'" />'; $output .= '</a></figure>'; } break; $k++; } } } } $output .= '<h5><a href="'.get_permalink($post->ID).'" title="'.get_the_title($post->ID).'">'; $output .= get_the_title($post->ID); $output .= '</a></h5>'; $custom = get_post_custom($post->ID); if($meta == 'true'){ $output .= '<span class="meta">'; $output .= '<span class="post-date">'; $output .= get_the_time( get_option( 'date_format' ) ); $output .= '</span>'; $output .= '<span class="post-comments">'.theme_locals('comments').": "; $output .= '<a href="'.get_comments_link($post->ID).'">'; $output .= get_comments_number($post->ID); $output .= '</a>'; $output .= '</span>'; $output .= '</span>'; } //display post options $output .= '<div class="post_options">'; switch($type_post) { case "team": $teampos = ($custom["my_team_pos"][0])?$custom["my_team_pos"][0]:""; $teaminfo = ($custom["my_team_info"][0])?$custom["my_team_info"][0]:""; $output .= "<span class='page-desc'>".$teampos."</span><br><span class='team-content post-content'>".$teaminfo."</span>"; break; case "testi": $testiname = $custom["my_testi_caption"][0]?$custom["my_testi_caption"][0]:""; $testiurl = $custom["my_testi_url"][0]?$custom["my_testi_url"][0]:""; $testiinfo = $custom["my_testi_info"][0]?$custom["my_testi_info"][0]:""; $output .="<span class='user'>".$testiname."</span>, <span class='info'>".$testiinfo."</span><br><a href='".$testiurl."'>".$testiurl."</a>"; break; case "portfolio": $portfolioClient = $custom["tz_portfolio_client"][0]?$custom["tz_portfolio_client"][0]:""; $portfolioDate = $custom["tz_portfolio_date"][0]?$custom["tz_portfolio_date"][0]:""; $portfolioInfo = $custom["tz_portfolio_info"][0]?$custom["tz_portfolio_info"][0]:""; $portfolioURL = $custom["tz_portfolio_url"][0]?$custom["tz_portfolio_url"][0]:""; $output .="<strong class='portfolio-meta-key'>".theme_locals('client').": </strong><span> ".$portfolioClient."</span><br>"; $output .="<strong class='portfolio-meta-key'>".theme_locals('date').": </strong><span> ".$portfolioDate."</span><br>"; $output .="<strong class='portfolio-meta-key'>".theme_locals('info').": </strong><span> ".$portfolioInfo."</span><br>"; $output .="<a href='".$portfolioURL."'>".theme_locals('launch_project')."</a><br>"; break; default: $output .=""; }; $output .= '</div>'; if($excerpt_count >= 1){ $output .= '<p class="excerpt">'; $output .= my_string_limit_words($excerpt,$excerpt_count); $output .= '</p>'; } if($more_text_single!=""){ $output .= '<a href="'.get_permalink($post->ID).'" class="btn btn-primary" title="'.get_the_title($post->ID).'">'; $output .= $more_text_single; $output .= '</a>'; } $output .= '</li>'; } $output .= '</ul>'; $output .= '</div>'; return $output; }
function shortcode_post_cycle($atts, $content = null, $shortcodename = '') { extract(shortcode_atts(array('num' => '5', 'type' => 'post', 'meta' => '', 'effect' => 'slide', 'thumb' => 'true', 'thumb_width' => '200', 'thumb_height' => '180', 'more_text_single' => __('Read more', CHERRY_PLUGIN_DOMAIN), 'category' => '', 'custom_category' => '', 'excerpt_count' => '15', 'pagination' => 'true', 'navigation' => 'true', 'custom_class' => ''), $atts)); $type_post = $type; $slider_pagination = $pagination; $slider_navigation = $navigation; $random = gener_random(10); $i = 0; $rand = rand(); $count = 0; if (is_rtl()) { $is_rtl = 'true'; } else { $is_rtl = 'false'; } $output = '<script type="text/javascript"> jQuery(window).load(function() { jQuery("#flexslider_' . $random . '").flexslider({ animation: "' . $effect . '", smoothHeight : true, directionNav: ' . $slider_navigation . ', controlNav: ' . $slider_pagination . ', rtl: ' . $is_rtl . ' }); });'; $output .= '</script>'; $output .= '<div id="flexslider_' . $random . '" class="flexslider no-bg ' . $custom_class . '">'; $output .= '<ul class="slides">'; global $post; global $my_string_limit_words; // WPML filter $suppress_filters = get_option('suppress_filters'); $args = array('post_type' => $type_post, 'category_name' => $category, $type_post . '_category' => $custom_category, 'numberposts' => $num, 'orderby' => 'post_date', 'order' => 'DESC', 'suppress_filters' => $suppress_filters); $latest = get_posts($args); foreach ($latest as $key => $post) { //Check if WPML is activated if (defined('ICL_SITEPRESS_VERSION')) { global $sitepress; $post_lang = $sitepress->get_language_for_element($post->ID, 'post_' . $type_post); $curr_lang = $sitepress->get_current_language(); // Unset not translated posts if ($post_lang != $curr_lang) { unset($latest[$key]); } // Post ID is different in a second language Solution if (function_exists('icl_object_id')) { $post = get_post(icl_object_id($post->ID, $type_post, true)); } } setup_postdata($post); $excerpt = get_the_excerpt(); $attachment_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $url = $attachment_url['0']; $image = aq_resize($url, $thumb_width, $thumb_height, true); $output .= '<li class="list-item-' . $count . '">'; if ($type == "testi") { $output .= '<figure class="quote-thumb"><i class="icon-quote-right "></i></figure>'; } if ($thumb == 'true') { if (has_post_thumbnail($post->ID)) { $output .= '<figure class="thumbnail featured-thumbnail"><a href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; $output .= '<img src="' . $image . '" alt="' . get_the_title($post->ID) . '" />'; $output .= '</a></figure>'; } elseif ($type == "testi") { $output .= '<figure class="empty-thumb"><i class="icon-user"></i></figure>'; } } $output .= '<h5><a href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; $output .= get_the_title($post->ID); $output .= '</a></h5>'; if ($meta == 'true') { $output .= '<span class="meta">'; $output .= '<span class="post-date">'; $output .= get_the_date(); $output .= '</span>'; $output .= '<span class="post-comments">' . __('Comments', CHERRY_PLUGIN_DOMAIN) . ": "; $output .= '<a href="' . get_comments_link($post->ID) . '">'; $output .= get_comments_number($post->ID); $output .= '</a>'; $output .= '</span>'; $output .= '</span>'; } //display post options if ($type == "testi") { $output .= '<div class="extra-wrap">'; } if ($excerpt_count >= 1) { $output .= '<p class="excerpt"><a href="' . get_comments_link($post->ID) . '">"'; $output .= my_string_limit_words($excerpt, $excerpt_count); $output .= '</a></p>'; } $output .= '<div class="post_options">'; switch ($type_post) { case "team": $teampos = get_post_meta($post->ID, 'my_team_pos', true); $team_email = sanitize_email(get_post_meta($post->ID, 'my_team_email', true)); $teaminfo = get_post_meta($post->ID, 'my_team_info', true); if (!empty($teampos)) { $output .= "<span class='page-desc'>" . $teampos . "</span><br>"; } if (!empty($team_email) && is_email($team_email)) { $output .= '<span class="team-email"><a href="mailto:' . antispambot($team_email, 1) . '">' . antispambot($team_email) . ' </a></span><br>'; } if (!empty($teaminfo)) { $output .= '<span class="team-content post-content team-info">' . esc_html($teaminfo) . '</span>'; } $output .= cherry_get_post_networks(array('post_id' => $post->ID, 'display_title' => false, 'output_type' => 'return')); break; case "testi": $testiname = get_post_meta($post->ID, 'my_testi_caption', true); $testiurl = esc_url(get_post_meta($post->ID, 'my_testi_url', true)); $testiinfo = get_post_meta($post->ID, 'my_testi_info', true); $testiemail = sanitize_email(get_post_meta($post->ID, 'my_testi_email', true)); if (!empty($testiname)) { $output .= '<span class="user">- ' . $testiname . '</span>'; } if (!empty($testiinfo)) { $output .= '<span class="info">, ' . $testiinfo . '</span><br>'; } if (!empty($testiurl)) { $output .= '<a class="testi-url" href="' . $testiurl . '" target="_blank">' . $testiurl . '</a><br>'; } if (!empty($testiemail) && is_email($testiemail)) { $output .= '<a class="testi-email" href="mailto:' . antispambot($testiemail, 1) . '">' . antispambot($testiemail) . ' </a>'; } break; case "portfolio": $portfolioClient = get_post_meta($post->ID, 'tz_portfolio_client', true) ? get_post_meta($post->ID, 'tz_portfolio_client', true) : ""; $portfolioDate = get_post_meta($post->ID, 'tz_portfolio_date', true) ? get_post_meta($post->ID, 'tz_portfolio_date', true) : ""; $portfolioInfo = get_post_meta($post->ID, 'tz_portfolio_info', true) ? get_post_meta($post->ID, 'tz_portfolio_info', true) : ""; $portfolioURL = get_post_meta($post->ID, 'tz_portfolio_url', true) ? get_post_meta($post->ID, 'tz_portfolio_url', true) : ""; $output .= "<strong class='portfolio-meta-key'>" . __('Client', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioClient . "</span><br>"; $output .= "<strong class='portfolio-meta-key'>" . __('Date', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioDate . "</span><br>"; $output .= "<strong class='portfolio-meta-key'>" . __('Info', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioInfo . "</span><br>"; $output .= "<a href='" . $portfolioURL . "'>" . __('Launch Project', CHERRY_PLUGIN_DOMAIN) . "</a><br>"; break; default: $output .= ""; } $output .= '</div>'; if ($type == "testi") { $output .= '</div>'; } if ($more_text_single != "") { $output .= '<a href="' . get_permalink($post->ID) . '" class="btn btn-primary" title="' . get_the_title($post->ID) . '">'; $output .= $more_text_single; $output .= '</a>'; } $output .= '</li>'; $count++; } wp_reset_postdata(); // restore the global $post variable $output .= '</ul>'; $output .= '</div>'; $output = apply_filters('cherry_plugin_shortcode_output', $output, $atts, $shortcodename); return $output; }
<article id="post-<?php the_ID(); ?>" <?php post_class('post__holder'); ?>> <?php if(!is_singular()) : ?> <header class="post-header"> <h2 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php echo theme_locals("permalink_to");?> <?php the_title(); ?>"><?php the_title(); ?></a></h2> </header> <?php endif; ?> <?php $random = gener_random(10); ?> <script type="text/javascript"> // Can also be used with $(document).ready() $(window).load(function() { $('#flexslider_<?php echo $random ?>').flexslider({ animation: "slide", smoothHeight: true }); }); </script> <!-- Gallery Post --> <div class="gallery-post"> <!-- Slider --> <div id="flexslider_<?php echo $random ?>" class="flexslider thumbnail"> <ul class="slides"> <?php $args = array( 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => get_the_ID(), 'post_mime_type'=> 'image',
function shortcode_post_cycle($atts, $content = null) { wp_enqueue_script('flexslider', CHERRY_PLUGIN_URL . 'includes/assets/js/jquery.flexslider.js', array('jquery'), '2.1', true); extract(shortcode_atts(array('num' => '5', 'type' => 'post', 'meta' => '', 'effect' => 'slide', 'thumb' => 'true', 'thumb_width' => '200', 'thumb_height' => '180', 'more_text_single' => __('Read more', CHERRY_PLUGIN_DOMAIN), 'category' => '', 'custom_category' => '', 'excerpt_count' => '15', 'pagination' => 'true', 'navigation' => 'true', 'custom_class' => ''), $atts)); $type_post = $type; $slider_pagination = $pagination; $slider_navigation = $navigation; $random = gener_random(10); $i = 0; $rand = rand(); $output = '<script type="text/javascript"> jQuery(window).load(function() { jQuery("#flexslider_' . $random . '").flexslider({ animation: "' . $effect . '", smoothHeight : true, directionNav: ' . $slider_navigation . ', controlNav: ' . $slider_pagination . ' }); });'; $output .= '</script>'; $output .= '<div id="flexslider_' . $random . '" class="flexslider no-bg ' . $custom_class . '">'; $output .= '<ul class="slides">'; global $post; global $my_string_limit_words; // WPML filter $suppress_filters = get_option('suppress_filters'); $args = array('post_type' => $type_post, 'category_name' => $category, $type_post . '_category' => $custom_category, 'numberposts' => $num, 'orderby' => 'post_date', 'order' => 'DESC', 'suppress_filters' => $suppress_filters); $latest = get_posts($args); foreach ($latest as $key => $post) { // Unset not translated posts if (function_exists('wpml_get_language_information')) { global $sitepress; $check = wpml_get_language_information($post->ID); $language_code = substr($check['locale'], 0, 2); if ($language_code != $sitepress->get_current_language()) { unset($latest[$key]); } // Post ID is different in a second language Solution if (function_exists('icl_object_id')) { $post = get_post(icl_object_id($post->ID, $type_post, true)); } } setup_postdata($post); $excerpt = get_the_excerpt(); $attachment_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $url = $attachment_url['0']; $image = aq_resize($url, $thumb_width, $thumb_height, true); $output .= '<li>'; if ($thumb == 'true') { if (has_post_thumbnail($post->ID)) { $output .= '<figure class="thumbnail featured-thumbnail"><a href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; $output .= '<img src="' . $image . '" alt="' . get_the_title($post->ID) . '" />'; $output .= '</a></figure>'; } else { $thumbid = 0; $thumbid = get_post_thumbnail_id($post->ID); $images = get_children(array('orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1)); if ($images) { $k = 0; //looping through the images foreach ($images as $attachment_id => $attachment) { // $prettyType = "prettyPhoto-".$rand ."[gallery".$i."]"; //if( $attachment->ID == $thumbid ) continue; $image_attributes = wp_get_attachment_image_src($attachment_id, 'full'); // returns an array $img = aq_resize($image_attributes[0], $thumb_width, $thumb_height, true); //resize & crop img $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); $image_title = $attachment->post_title; if ($k == 0) { $output .= '<figure class="featured-thumbnail">'; $output .= '<a href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; $output .= '<img src="' . $img . '" alt="' . get_the_title($post->ID) . '" />'; $output .= '</a></figure>'; } break; $k++; } } } } $output .= '<h5><a href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; $output .= get_the_title($post->ID); $output .= '</a></h5>'; if ($meta == 'true') { $output .= '<span class="meta">'; $output .= '<span class="post-date">'; $output .= get_the_date(); $output .= '</span>'; $output .= '<span class="post-comments">' . __('Comments', CHERRY_PLUGIN_DOMAIN) . ": "; $output .= '<a href="' . get_comments_link($post->ID) . '">'; $output .= get_comments_number($post->ID); $output .= '</a>'; $output .= '</span>'; $output .= '</span>'; } //display post options $output .= '<div class="post_options">'; switch ($type_post) { case "team": $teampos = get_post_meta($post->ID, 'my_team_pos', true) ? get_post_meta($post->ID, 'my_team_pos', true) : ""; $teaminfo = get_post_meta($post->ID, 'my_team_info', true) ? get_post_meta($post->ID, 'my_team_info', true) : ""; $output .= "<span class='page-desc'>" . $teampos . "</span><br><span class='team-content post-content'>" . $teaminfo . "</span>"; $output .= cherry_get_post_networks(array('post_id' => $post->ID, 'display_title' => false, 'output_type' => 'return')); break; case "testi": $testiname = get_post_meta($post->ID, 'my_testi_caption', true) ? get_post_meta($post->ID, 'my_testi_caption', true) : ""; $testiurl = get_post_meta($post->ID, 'my_testi_url', true) ? get_post_meta($post->ID, 'my_testi_url', true) : ""; $testiinfo = get_post_meta($post->ID, 'my_testi_info', true) ? get_post_meta($post->ID, 'my_testi_info', true) : ""; $output .= "<span class='user'>" . $testiname . "</span>, <span class='info'>" . $testiinfo . "</span><br><a href='" . $testiurl . "'>" . $testiurl . "</a>"; break; case "portfolio": $portfolioClient = get_post_meta($post->ID, 'tz_portfolio_client', true) ? get_post_meta($post->ID, 'tz_portfolio_client', true) : ""; $portfolioDate = get_post_meta($post->ID, 'tz_portfolio_date', true) ? get_post_meta($post->ID, 'tz_portfolio_date', true) : ""; $portfolioInfo = get_post_meta($post->ID, 'tz_portfolio_info', true) ? get_post_meta($post->ID, 'tz_portfolio_info', true) : ""; $portfolioURL = get_post_meta($post->ID, 'tz_portfolio_url', true) ? get_post_meta($post->ID, 'tz_portfolio_url', true) : ""; $output .= "<strong class='portfolio-meta-key'>" . __('Client', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioClient . "</span><br>"; $output .= "<strong class='portfolio-meta-key'>" . __('Date', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioDate . "</span><br>"; $output .= "<strong class='portfolio-meta-key'>" . __('Info', CHERRY_PLUGIN_DOMAIN) . ": </strong><span> " . $portfolioInfo . "</span><br>"; $output .= "<a href='" . $portfolioURL . "'>" . __('Launch Project', CHERRY_PLUGIN_DOMAIN) . "</a><br>"; break; default: $output .= ""; } $output .= '</div>'; if ($excerpt_count >= 1) { $output .= '<p class="excerpt">'; $output .= my_string_limit_words($excerpt, $excerpt_count); $output .= '</p>'; } if ($more_text_single != "") { $output .= '<a href="' . get_permalink($post->ID) . '" class="btn btn-primary" title="' . get_the_title($post->ID) . '">'; $output .= $more_text_single; $output .= '</a>'; } $output .= '</li>'; } wp_reset_postdata(); // restore the global $post variable $output .= '</ul>'; $output .= '</div>'; return $output; }