function tfuse_latest_news($atts, $content = null) { extract(shortcode_atts(array('posts' => '', 'title' => '', 'b_title' => '', 'b_link' => ''), $atts)); $posts = explode(',', $posts); $return_html = $img = ''; if (!empty($posts)) { $return_html .= '<section class="postlist postlist-cols-1 shortcode_news"> <h1>' . $title . '</h1>'; foreach ($posts as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post, 'post-thumbnails')); $img_pos = tfuse_page_options('single_img_position', '', $post); $post_date = get_the_date($post); $time = strtotime($post_date); $position = tfuse_page_options('img_pos', '', $post); $current_post = get_post($post); $user_data = get_user_by('id', $current_post->post_author); $return_html .= '<article class="post"> <div class="inner">'; $press_source = tfuse_page_options('press_source', '', $post); $press_author = tfuse_page_options('press_author', '', $post); $is_outer_link = !empty($press_source) ? true : false; $target_window = !empty($press_source) ? "_blank" : "_self"; $author_url = !empty($press_source) ? $press_source : get_author_posts_url($current_post->post_author, $user_data->data->user_nicename); $press_source = !empty($press_source) ? $press_source : get_permalink($post); $press_author = !empty($press_author) ? $press_author : $user_data->data->display_name; if (!empty($image)) { $return_html .= '<a class="post-thumbnail" href="' . $press_source . '"><img src="' . $image . '" alt="' . get_the_title($post) . '" /></a>'; } $return_html .= '<div class="entry-aside"> <header class="entry-header"> <h2 class="entry-title"><a target="' . $target_window . '" href="' . $press_source . '">' . get_the_title($post) . '</a></h2> <div class="entry-meta"> ' . __('By ', 'tfuse') . '<span class="author"><a href="' . $author_url . '">' . $press_author . '</a></span> ' . __(' on ', 'tfuse') . '<time class="entry-date" datetime="' . date('Y-m-d', $time) . 'T' . date('g:i:s', $time) . '">' . get_the_time(get_option('date_format'), $post) . '</time> </div> </header> <div class="entry-content">'; if (tfuse_options('post_content') == 'content') { $return_html .= '<p>' . $current_post->post_content . '</p>'; } else { $return_html .= !empty($current_post->post_excerpt) ? '<p>' . $current_post->post_excerpt . '</p>' : '<p>' . strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)) . '</p>'; } $tmp_comments = $is_outer_link ? '' : '<span class="comments-link"><a href="' . $press_source . '#comments"><i class="tficon-comment"></i> ' . get_comments_number($post) . '</a></span>'; $return_html .= '</div> <footer class="entry-meta"> <a target="' . $target_window . '" class="btn btn-default btn-xs" href="' . $press_source . '">' . __('Read more', 'tfuse') . '</a> ' . $tmp_comments . ' </footer> </div> </div> </article>'; } $return_html .= '<div class="load_button"> <a href="' . $b_link . '" class="btn btn-main">' . $b_title . '</a> </div>'; $return_html .= '</section>'; } return $return_html; }
function tfuse_shortcode_news($atts, $content = null) { extract(shortcode_atts(array('posts' => ''), $atts)); $out = ''; $posts = explode(',', $posts); if (!empty($posts)) { $posts = array_reverse($posts); $out .= '<section class="postlist postlist-cols-4">'; foreach ($posts as $post) { $post_image_src = wp_get_attachment_url(get_post_thumbnail_id($post, 'post-thumbnails')); if (!empty($post_image_src)) { $img = $post_image_src; } $current_post = get_post($post); $content = !empty($current_post->post_excerpt) ? strip_tags(tfuse_shorten_string($current_post->post_excerpt, 20)) : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 20)); $out .= '<article class="post"> <div class="inner">'; if (!empty($img)) { $out .= '<a class="post-thumbnail" href="' . get_permalink($post) . '"><img src="' . $img . '" alt="' . get_the_title($post) . '" /></a>'; } $out .= '<div class="entry-aside"> <header class="entry-header"> <h2 class="entry-title"><a href="' . get_permalink($post) . '">' . get_the_title($post) . '</a></h2> </header> <div class="entry-content"> <p>' . $content . '</p> </div> <footer class="entry-meta"> <a class="btn btn-default btn-xs" href="' . get_permalink($post) . '">' . __('Read more', 'tfuse') . '</a> <span class="comments-link"><a href="' . get_permalink($post) . '#comments"><i class="tficon-comment"></i> ' . get_comments_number($post) . '</a></span> </footer> </div> </div> </article>'; } $out .= '</section>'; } return $out; }
function tfuse_shortcode_latest_post($atts, $content = null) { $out = ''; $recent_post = wp_get_recent_posts(array('numberposts' => 1)); if (!empty($recent_post)) { foreach ($recent_post as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post['ID'], 'post-thumbnails')); $get_image = new TF_GET_IMAGE(); $img = $get_image->properties(array('class' => '', 'alt' => get_the_title($post['ID'])))->width(210)->height(82)->src($image)->resize(true)->get_img(); $current_post = get_post($post['ID']); $user_data = get_user_by('id', $current_post->post_author); $out .= '<article class="post"> <h2 class="entry-title"><a href="' . get_permalink($post['ID']) . '">' . get_the_title($post['ID']) . '</a></h2> <div class="entry-meta"> <time class="entry-date" datetime="">' . get_the_time(get_option('date_format'), $post['ID']) . '</time> <span class="author"> ' . __('by', 'tfuse') . ' <a href="' . get_author_posts_url($current_post->post_author, $user_data->data->user_nicename) . '">' . $user_data->data->user_nicename . '</a></span> </div> <span class="post-thumbnail">'; if (!empty($image)) { $out .= $img; } $out .= '</span> <div class="entry-content"><p>'; if (tfuse_options('post_content') == 'content') { $out .= $current_post->post_content; } else { $out .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $out .= '</p></div> <footer class="entry-meta"> <a href="' . get_permalink($post['ID']) . '" class="btn btn-yellow"><span>' . __('find out more', 'tfuse') . '</span></a> </footer> </article>'; } } return $out; }
"><img src="<?php echo $image; ?> " alt="<?php echo get_the_title($id); ?> "/></a> <?php } ?> <div class="entry-content"> <?php if (tfuse_options('post_content') == 'content') { echo $current_post->post_content; } else { echo !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } ?> </div> <footer class="entry-meta"> <a class="btn btn-default btn-xs" href="<?php echo get_permalink($id); ?> "><?php _e('Read more', 'tfuse'); ?> </a> <span class="comments-link"><a href="<?php echo get_permalink($id); ?>
function tfuse_projects($atts, $content = null) { extract(shortcode_atts(array('post' => ''), $atts)); $output = ''; $uniq = rand(1, 100); $post = explode(',', $post); $query = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'project', 'orderby' => 'post__in', 'post__in' => $post)); $posts = $query->get_posts(); if (!empty($posts)) { $output .= '<div class="recent-slider"> <ul id="recent-slider' . $uniq . '">'; foreach ($posts as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); if (!empty($image)) { $image = TF_GET_IMAGE::get_src_link($image, 285, 326); } $current_post = get_post($post->ID); $output .= '<li data-recentslider1="1"> <div class="recent-slider-text"> <h3 class="title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h3> <div class="line-title-sldier"></div> <div class="recent-slider-description">'; if (tfuse_options('post_content') == 'content') { $output .= $current_post->post_content; } else { $output .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $output .= '</div> </div> <div class="recent-slider-image"> <a href="' . get_permalink($post->ID) . '" class="recent-slider-thumbnail"><span>' . __('More', 'tfuse') . '</span></a> <img src="' . $image . '" > </div> </li>'; } $output .= '</ul> <div id="recent-slider' . $uniq . '-controls" class="recent-slider-controls"></div> <a id="recent-slider' . $uniq . '-prev" class="prev" href="#">prev</a> <a id="recent-slider' . $uniq . '-next" class="next" href="#">next</a> </div>'; $output .= ' <script> jQuery(document).ready(function(){ function recentsliderInit() { jQuery("#recent-slider' . $uniq . '").carouFredSel({ swipe : { onTouch: true }, next : "#recent-slider' . $uniq . '-next", prev : "#recent-slider' . $uniq . '-prev", pagination : "#recent-slider' . $uniq . '-controls", infinite: false, items: 1, auto: { play: false, timeoutDuration: 0 }, scroll: { items : 1, fx: "crossfade", easing: "linear", pauseOnHover: true, duration: 300 } }); } recentsliderInit(); jQuery(window).resize(function() { recentsliderInit(); }); var tControlsHeight = jQuery(".recent-slider-controls").innerHeight(); jQuery(".recent-slider-controls").css("margin-top" , -tControlsHeight/2); //Script align center the text for two mini slider var caroufredsel_wrapper = jQuery(".caroufredsel_wrapper"); var recent_slider_text = jQuery(".recent-slider-text"); caroufredsel_wrapper.each(function(){ hei1 = jQuery(this).height(); recent_slider_text.each(function(){ hei2 = jQuery(this).height(); jQuery(this).css({ "padding-top" :hei1/2-hei2/2 }); }); }); }); </script> '; } return $output; }
function tfuse_ajax_get_game_posts() { $post_id = intval($_POST['post_id']); $posts_from = $_POST['posts_from']; $out = $out1 = $out2 = $out3 = $out4 = ''; //get news posts for current game post if ($posts_from == 'game_news') { $posts = tfuse_get_game_posts($post_id, 'news'); $out1 .= '<section class="postlist postlist-blog ajax_section_load"> <h1>' . __('News', 'tfuse') . '</h1>'; if (!empty($posts)) { $k = 0; foreach ($posts as $id) { $press_source = tfuse_page_options('press_source', '', $id); $press_author = tfuse_page_options('press_author', '', $id); $is_outer_link = !empty($press_source) ? true : false; $target_window = !empty($press_source) ? "_blank" : "_self"; $author_url = !empty($press_source) ? '' : get_author_posts_url($current_post->post_author, $user_data->data->user_nicename); $press_source = !empty($press_source) ? $press_source : get_permalink($post); $press_author = !empty($press_author) ? $press_author : $user_data->data->display_name; if ($k == get_option('posts_per_page')) { break; } $image = wp_get_attachment_url(get_post_thumbnail_id($id, 'post-thumbnails')); $img_pos = tfuse_page_options('single_img_position', '', $id); $current_post = get_post($id); $user_data = get_user_by('id', $current_post->post_author); $tmp_url = !empty($author_url) ? '<a href="' . $author_url . '">' . $press_author . '</a>' : '<span>' . $press_author . '</span>'; $out .= '<article class="post"> <div class="inner"> <div class="entry-aside"> <header class="entry-header"> <h1 class="entry-title"><a target="' . $target_window . '" href="' . $press_source . '">' . get_the_title($id) . '</a></h1> <div class="entry-meta"> ' . __('By ', 'tfuse') . '<span class="author">' . $tmp_url . '</span> ' . __(' on ', 'tfuse') . ' <time class="entry-date" datetime="">' . get_the_time(get_option('date_format'), $id) . '</time> </div> </header>'; if (!empty($image)) { $out .= '<a target="' . $target_window . '" class="post-thumbnail ' . $img_pos . ' clearfix" href="' . $press_source . '"><img src="' . $image . '" alt="' . get_the_title($id) . '"/></a>'; } $out .= '<div class="entry-content">'; if (tfuse_options('post_content') == 'content') { $out .= $current_post->post_content; } else { $out .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $tmp_comments = $is_outer_link ? '' : '<span class="comments-link"><a href="' . $author_url . '#comments"><i class="tficon-comment"></i> ' . get_comments_number($id) . '</a></span>'; $out .= '</div> <footer class="entry-meta"> <a target="' . $target_window . '" class="btn btn-default btn-xs" href="' . $press_source . '">' . __('Read more', 'tfuse') . '</a> ' . $tmp_comments . ' </footer> </div> </div> </article>'; $k++; } } else { $out .= '<h5>' . __('Sorry, no news for this game.', 'tfuse') . '</h5>'; } $out2 .= '</section>'; if (get_option('posts_per_page') < count($posts)) { $out3 .= '<div class="load_button"> <button type="submit" class="btn btn-main" id="load_game_posts" data-post-id="' . $post_id . '" data-from="game_news" >' . __('Load More', 'tfuse') . '</button> <button type="submit" class="btn btn-main" id="loading_game_posts">' . __('Loading...', 'tfuse') . '</button> </div>'; } } elseif ($posts_from == 'game_reviews') { $posts = tfuse_get_game_posts($post_id, 'reviews'); $out1 .= '<section class="postlist postlist-cols-1 ajax_section_load"> <h1>' . __('Description', 'tfuse') . '</h1>'; if (!empty($posts)) { $k = 0; foreach ($posts as $id) { if ($k == get_option('posts_per_page')) { break; } $rating = tfuse_page_options('rating', '', $id); $featured = tfuse_page_options('featured', '', $id); $current_post = get_post($id); $user_data = get_user_by('id', $current_post->post_author); $out .= '<article class="post"> <div class="inner"> <div class="entry-aside"> <header class="entry-header">'; //$out .= '<h1 class="entry-title">'.get_the_title($id).'</h1> // <div class="entry-meta"> $out .= ' </div> </header> <div class="entry-content">'; $out .= $current_post->post_content; $out .= '</div> </div> </div> </article>'; $k++; } } else { $out .= '<h5>' . __('Sorry, no reviews for this game.', 'tfuse') . '</h5>'; } $out2 .= '</section>'; if (get_option('posts_per_page') < count($posts)) { $out3 .= '<div class="load_button"> <button type="submit" class="btn btn-main" id="load_game_posts" data-post-id="' . $post_id . '" data-from="game_reviews">' . __('Load More', 'tfuse') . '</button> <button type="submit" class="btn btn-main" id="loading_game_posts">' . __('Loading...', 'tfuse') . '</button> </div>'; } } elseif ($posts_from == 'game_images') { $posts = tfuse_get_game_posts($post_id, 'images'); $terms = tfuse_get_game_filter_terms('gallery', 'galleries', $post_id); $out1 .= '<article class="post post-details portfolio"> <header class="entry-header"> <h1 class="entry-title">' . __('Images', 'tfuse') . '</h1> </header> <div class="entry-content"> <div class="top-filter terms-game-filter" id="gallery_filter"> <span class="top-filter-title">' . __('Filter', 'tfuse') . ':</span> <ul> <li><a href="" class="btn btn-simple btn-sm active" data-term="all" data-game-post="' . $post_id . '">' . __('All', 'tfuse') . '</a></li>'; if (!empty($terms)) { foreach ($terms as $term_id) { $term = get_term_by('id', $term_id, 'galleries'); $out1 .= '<li><a href="" class="btn btn-simple btn-sm" data-term="' . $term->term_id . '" data-game-post="' . $post_id . '">' . $term->name . '</a></li>'; } } $out1 .= '</ul> </div> <ul class="portfolio-list ajax_section_load" id="game-portfolio-list" >'; if (!empty($posts)) { $k = 0; $pretty = tfuse_options('portf_type'); foreach ($posts as $id) { if ($k == get_option('posts_per_page')) { break; } $image = wp_get_attachment_url(get_post_thumbnail_id($id, 'post-thumbnails')); if ($pretty == 'pretty') { $rel = 'data-rel="prettyPhoto[gallery]"'; $url = wp_get_attachment_url(get_post_thumbnail_id($id, 'post-thumbnails')); } else { $rel = ''; $url = get_permalink($id); } $out .= '<li> <a href="' . $url . '" ' . $rel . ' title="' . get_the_title($id) . '">'; if (!empty($image)) { $out .= '<img src="' . $image . '" />'; } else { $out .= '<img src="' . get_template_directory_uri() . '/images/gallery_small.jpg" width="166" height="166" alt=""/>'; } $out .= '</a> </li>'; $k++; } } else { $out .= '<h5>' . __('Sorry, no images for this game.', 'tfuse') . '</h5>'; } $out2 .= '</ul>'; if (get_option('posts_per_page') < count($posts)) { $out3 .= '<div class="load_button"> <button type="submit" class="btn btn-main" data-post-id="' . $post_id . '" data-from="game_images" id="load_game_posts" value="Send">' . __('Load More', 'tfuse') . '</button> <button type="submit" class="btn btn-main" id="loading_game_posts">' . __('Loading...', 'tfuse') . '</button> </div>'; } $out4 .= '</article>'; } elseif ($posts_from == 'game_videos') { $posts = tfuse_get_game_posts($post_id, 'videos'); $terms = tfuse_get_game_filter_terms('video', 'videos', $post_id); $out1 .= '<article class="post post-details portfolio portfolio-videos"> <header class="entry-header"> <h1 class="entry-title">' . __('Videos', 'tfuse') . '</h1> </header> <div class="entry-content"> <div class="top-filter terms-game-filter" id="video_filter"> <span class="top-filter-title">' . __('Filter', 'tfuse') . ':</span> <ul> <li><a href="" class="btn btn-simple btn-sm active" data-term="all" data-game-post="' . $post_id . '">' . __('All', 'tfuse') . '</a></li>'; if (!empty($terms)) { foreach ($terms as $term_id) { $term = get_term_by('id', $term_id, 'videos'); $out1 .= '<li><a href="" class="btn btn-simple btn-sm" data-term="' . $term->term_id . '" data-game-post="' . $post_id . '">' . $term->name . '</a></li>'; } } $out1 .= '</ul> </div> <ul class="portfolio-list ajax_section_load" id="game-portfolio-list">'; if (!empty($posts)) { $k = 0; foreach ($posts as $id) { if ($k == get_option('posts_per_page')) { break; } $video = tfuse_page_options('video_links', '', $id); $image = wp_get_attachment_url(get_post_thumbnail_id($id, 'post-thumbnails')); $video_link = !empty($video) ? $video : wp_get_attachment_url(get_post_thumbnail_id($id, 'post-thumbnails')); $out .= '<li> <a data-rel="prettyPhoto" title="' . get_the_title($id) . '" href="' . $video_link . '">'; if (!empty($image)) { $out .= '<img src="' . $image . '" />'; } else { $out .= '<img src="' . get_template_directory_uri() . '/images/gallery_medium.jpg" width="333" height="222" alt=""/>'; } $out .= '</a> <h4><a class="video_link" href="' . get_permalink($id) . '">' . get_the_title($id) . '</a></h4> </li>'; $k++; } } else { $out .= '<h5>' . __('Sorry, no images for this game.', 'tfuse') . '</h5>'; } $out2 .= '</ul>'; if (get_option('posts_per_page') < count($posts)) { $out3 .= '<div class="load_button"> <button type="submit" class="btn btn-main" data-post-id="' . $post_id . '" data-from="game_videos" id="load_game_posts" value="Send">' . __('Load More', 'tfuse') . '</button> <button type="submit" class="btn btn-main" id="loading_game_posts">' . __('Loading...', 'tfuse') . '</button> </div>'; } $out4 .= '</article>'; } elseif ($posts_from == 'game_guides') { $posts = $first_term = ''; $terms = tfuse_get_game_filter_terms('guide', 'guides', $post_id, true); if (!empty($terms)) { foreach ($terms as $term_id) { $term = get_term_by('id', $term_id, 'guides'); $posts = tfuse_get_game_posts($post_id, 'guides', $term->term_id); break; } } $out1 .= '<article class="post post-details portfolio"> <header class="entry-header"> <h1 class="entry-title">' . __('Guides', 'tfuse') . '</h1> </header> <div class="entry-content"> <div class="top-filter terms-game-filter" id="guides_filter"> <span class="top-filter-title">' . __('Filter', 'tfuse') . ':</span> <ul>'; if (!empty($terms)) { $k = 0; foreach ($terms as $term_id) { $k++; $term = get_term_by('id', $term_id, 'guides'); if ($k == 1) { $first_term = $term->term_id; $out1 .= '<li><a href="" class="btn btn-simple btn-sm active" data-term="' . $term->term_id . '" data-game-post="' . $post_id . '">' . $term->name . '</a></li>'; } else { $out1 .= '<li><a href="" class="btn btn-simple btn-sm" data-term="' . $term->term_id . '" data-game-post="' . $post_id . '">' . $term->name . '</a></li>'; } } } $out1 .= '</ul> </div> <div class="tab-content"> <div class="postlist postlist-simple ajax_section_load" id="game-portfolio-list">'; if (!empty($posts)) { $download = !empty($terms) ? tfuse_options('guides_posts', '', $terms[0]) : ''; $k = 0; if ($download == 'download') { foreach ($posts as $id) { if ($k == get_option('posts_per_page')) { break; } $current_post = get_post($id); //get download link $file = tfuse_page_options('upload_guide', '', $id); //get user data $user_data = get_user_by('id', $current_post->post_author); $out .= '<div class="post"> <h2 class="entry-title"><a href="' . get_permalink($id) . '">' . get_the_title($id) . '</a></h2>'; if (!empty($file)) { $out .= '<div class="entry-side-btn"> <a class="btn btn-default btn-xs" href="' . $file . '" target="_blank">' . __('Download', 'tfuse') . '</a> </div>'; } $out .= '<div class="entry-meta"> ' . __('By ', 'tfuse') . '<span class="author"><a href="' . get_author_posts_url($current_post->post_author, $user_data->data->user_nicename) . '">' . $user_data->data->display_name . '</a></span> ' . __(' on ', 'tfuse') . '<time class="entry-date" datetime="">' . get_the_time(get_option('date_format'), $id) . '</time> </div> </div>'; $k++; } } else { foreach ($posts as $id) { if ($k == get_option('posts_per_page')) { break; } $current_post = get_post($id); $out .= '<div class="post"> <h2 class="entry-title"><a href="' . get_permalink($id) . '">' . get_the_title($id) . '</a></h2> <div class="entry-content ">'; if (tfuse_options('post_content') == 'content') { $out .= $current_post->post_content; } else { $out .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $out .= '</div> </div>'; $k++; } } } else { $out .= '<h5>' . __('Sorry, no guides for this game.', 'tfuse') . '</h5>'; } $out2 .= '</div></div>'; if (get_option('posts_per_page') < count($posts)) { $out3 .= '<div class="load_button"> <button type="submit" class="btn btn-main" data-post-id="' . $post_id . '" data-term-id="' . $first_term . '" data-from="game_guides" id="load_game_posts" >' . __('Load More', 'tfuse') . '</button> <button type="submit" class="btn btn-main" id="loading_game_posts">' . __('Loading...', 'tfuse') . '</button> </div>'; } $out4 .= '</article>'; } $rsp = array('html' => $out1 . $out . $out2 . $out3 . $out4); echo json_encode($rsp); die; }
/** * Upcoming Events * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * */ function tfuse_upcoming_events($atts, $content = null) { tfuse_archive_events(); extract(shortcode_atts(array('items' => 3, 'title' => 'Popular Posts', 'link' => '', 'cat' => ''), $atts)); $return_html = ''; $saved_events = get_option(TF_THEME_PREFIX . '_all_array_events_' . $cat, ''); $uniq = rand(1, 100); $return_html .= '<div id="upcoming_events_load"></div> <input type="hidden" value="' . $cat . '" name="current_event" />'; $current_date = date("Y-m-d"); if (!empty($saved_events)) { $upcoming_events = $final_events = array(); $count = 0; $sorted = tfuse_aasort($saved_events, 'event_date'); foreach ($sorted as $event) { if ($event['event_date'] > $current_date) { $upcoming_events[$count]['event_id'] = $event['event_id']; $upcoming_events[$count]['event_date'] = $event['event_date']; ++$count; } } $items = (int) $items; $k = 0; for ($i = 0; $i < $items; $i++) { if ($upcoming_events[$i]['event_id']) { $final_events[$k]['event_id'] = $upcoming_events[$i]['event_id']; $final_events[$k]['event_date'] = $upcoming_events[$i]['event_date']; $k++; } } } $return_html .= '<section class="upcoming-events"> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="event-slide"> <div class="event-carousel"> <div id="myCarousel' . $uniq . '" >'; $return_html .= '<div class="col-md-6 col-sm-12 col-xs-12"> <div class="events"> <h3 class="section-title">' . $title . '</h3>'; if (!empty($link)) { $return_html .= ' <a href="' . $link . '" class="view-all" >' . __('View all', 'tfuse') . ' <span>+</span></a>'; } $return_html .= '<div class="events-navigation">'; if (!empty($final_events)) { $return_html .= '<ol class="carousel-indicators">'; $c = 0; foreach ($final_events as $event) { $active = $c == 0 ? 'active' : ""; $return_html .= ' <li data-target="#myCarousel' . $uniq . '" data-slide-to="' . $c . '" class="' . $active . '"> <i class="icon-calendar"></i> <div class="title-date"> <div class="event-date">' . $event['event_date'] . '</div> <h3 class="section-title">' . get_the_title($event['event_id']) . '</h3> </div> </li>'; $c++; } $return_html .= '</ol>'; } $return_html .= '</div></div>'; $return_html .= '</div>'; $return_html .= '<div class="carousel-inner col-md-6 col-sm-12 col-xs-12">'; if (!empty($final_events)) { $count = 0; foreach ($final_events as $event) { $act = $count == 0 ? 'active' : ""; $current_post = get_post($event['event_id']); $return_html .= '<div class="' . $act . ' item"> <div class="container"> <div class="wrapp-event-slider-text" data-animate-in="fadeIn" data-animate-out="fadeOut"> <div class="event-date">' . $event['event_date'] . '</div> <h3 class="section-title">' . get_the_title($event['event_id']) . '</h3> <div class="event-content"><p>'; $return_html .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); $return_html .= '</p></div> <a href="' . get_permalink($event['event_id']) . '" class="btn btn-transparent btn-event"><span>' . __('Event details', 'tfuse') . ' <i class="icon-chevron-right align-right-icon"></i></span></a> </div> </div> </div>'; $count++; } } $return_html .= '</div>'; $return_html .= '</div></div></div></div></div></div></section>'; $return_html .= "\r\n <script>\r\n\t\t\tjQuery(document).ready(function(\$) {\r\n\t\t\t\t//Event Slider\r\n\r\n\t\t\t\tvar slider2 = jQuery('#myCarousel" . $uniq . "'),\r\n\t\t\t\t\t\tanimateClass;\r\n\t\t\t\tslider2.carousel({\r\n\t\t\t\t\tinterval: 0,\r\n\t\t\t\t\tpause: 'none'\r\n\t\t\t\t});\r\n\t\t\t\tslider2.find('[data-animate-in]').addClass('animated');\r\n\r\n\t\t\t\tfunction animateSlideEvents() {\r\n\t\t\t\t\tslider2.find('.item').removeClass('current');\r\n\r\n\t\t\t\t\tslider2.find('.active').addClass('current').find('[data-animate-in]').each(function () {\r\n\t\t\t\t\t\tvar _this = jQuery(this);\r\n\t\t\t\t\t\tanimateClass = _this.data('animate-in');\r\n\t\t\t\t\t\t_this.addClass(animateClass)\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tslider2.find('.active').find('[data-animate-out]').each(function () {\r\n\t\t\t\t\t\tvar _this = jQuery(this);\r\n\t\t\t\t\t\tanimateClass = _this.data('animate-out');\r\n\t\t\t\t\t\t_this.removeClass(animateClass)\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tfunction animateSlideEndEvents() {\r\n\t\t\t\t\tslider2.find('.active').find('[data-animate-in]').each(function () {\r\n\t\t\t\t\t\tvar _this = jQuery(this);\r\n\t\t\t\t\t\tanimateClass = _this.data('animate-in');\r\n\t\t\t\t\t\t_this.removeClass(animateClass)\r\n\t\t\t\t\t});\r\n\t\t\t\t\tslider2.find('.active').find('[data-animate-out]').each(function () {\r\n\t\t\t\t\t\tvar _this = jQuery(this);\r\n\t\t\t\t\t\tanimateClass = _this.data('animate-out');\r\n\t\t\t\t\t\t_this.addClass(animateClass)\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tslider2.find('.invisible').removeClass('invisible');\r\n\t\t\t\tanimateSlideEvents();\r\n\r\n\t\t\t\tslider2.on('slid.bs.carousel', function () {\r\n\t\t\t\t\tanimateSlideEvents();\r\n\t\t\t\t});\r\n\t\t\t\tslider2.on('slide.bs.carousel', function () {\r\n\t\t\t\t\tanimateSlideEndEvents();\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (Modernizr.touch) {\r\n\t\t\t\t\tslider2.find('.carousel-inner').swipe( {\r\n\t\t\t\t\t\tswipeLeft: function() {\r\n jQuery(this).parent().carousel('prev');\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tswipeRight: function() {\r\n jQuery(this).parent().carousel('next');\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tthreshold: 30\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t</script>\r\n "; return $return_html; }
function tfuse_ajax_get_posts() { $post_type = $_POST['post_type']; $search_param = $_POST['search_param']; $max = intval($_POST['max']); $pageNum = intval($_POST['pageNum']); $search_key = $_POST['search_key']; $allhome = $_POST['allhome']; $allblog = $_POST['allblog']; $homepage = $_POST['homepage']; $cat_ids = $_POST['cat_ids']; $cat_ID = intval($_POST['id']); $is_tax = $_POST['is_tax']; $items = get_option('posts_per_page'); $pos4 = $pos1 = $pos2 = $pos3 = $pos5 = $pos6 = $pos7 = $pos8 = $pos9 = $allpos = $pos = $pos10 = $pos11 = $pos12 = $pos13 = $pos14 = $pos15 = $pos16 = $pos17 = ''; $posts = array(); if ($pageNum <= $max) { if ($homepage == 'homepage' && $allhome == 'nonehomeall') { $specific = tfuse_options('categories_select_categ'); if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'cat' => $specific); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'cat' => $specific); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($homepage == 'blogpage' && $allblog == 'allblogcategories') { if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'post_type' => 'post'); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'post_type' => 'post'); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($homepage == 'blogpage' && $allblog == 'noneblogall') { $specific = tfuse_options('categories_select_categ_blog'); $args = array('paged' => $pageNum, 'cat' => $specific); $query = new WP_Query($args); $posts = $query->posts; } elseif ($homepage == 'homepage' && $allhome == 'allhomecategories') { if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'post_type' => 'post'); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'cat' => $cat_ids); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($is_tax == 'category') { if (is_user_logged_in()) { $query = new WP_Query(array('post_status' => array('publish', 'private'), 'cat' => $cat_ID, 'paged' => $pageNum)); } else { $query = new WP_Query(array('post_status' => array('publish'), 'cat' => $cat_ID, 'paged' => $pageNum)); } $posts = $query->posts; } elseif ($is_tax == 'galleries') { if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'tax_query' => array(array('taxonomy' => 'galleries', 'field' => 'id', 'terms' => $cat_ID))); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'tax_query' => array(array('taxonomy' => 'galleries', 'field' => 'id', 'terms' => $cat_ID))); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($is_tax == 'projects') { if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'tax_query' => array(array('taxonomy' => 'projects', 'field' => 'id', 'terms' => $cat_ID))); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'tax_query' => array(array('taxonomy' => 'projects', 'field' => 'id', 'terms' => $cat_ID))); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($is_tax == 'search') { $query = new WP_Query(array('post_status' => array('publish'), 's' => $search_key, 'paged' => $pageNum)); $posts = $query->posts; } $cnt = 0; foreach ($posts as $post) { $cnt++; //get date format $d = get_option('date_format'); //get comments number $num_comments = get_comments_number($post->ID); if ($num_comments == 0) { $comments = __('No Comments', 'tfuse'); } elseif ($num_comments > 1) { $comments = $num_comments . __(' Comments', 'tfuse'); } else { $comments = __('1 Comment', 'tfuse'); } if ($is_tax == 'galleries') { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); $gallery = tfuse_page_options('gallery', '', $post->ID); $pos1 .= '<li class="gallery-item">'; if (!empty($image)) { $pos2 .= '<div class="gallery-img"> <a href="' . $image . '" class="see-more-gallery" data-rel="prettyPhoto[' . $post->ID . ']" title="' . $post->post_title . '"> <span>' . __('More', 'tfuse') . '</span> </a> <img src="' . TF_GET_IMAGE::get_src_link($image, 270, 270) . '" alt=""> </div>'; if (!empty($gallery)) { $pos3 .= '<div class="gallery-array">'; foreach ($gallery as $img) { $pos4 .= '<a href="' . $img['url'] . '" data-rel="prettyPhoto[' . $post->ID . ']" title="' . $img['title'] . '"> </a>'; } $pos5 .= '</div>'; } } $pos5 .= '<span class="title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></span> </li>'; $pos = $pos1 . $pos2 . $pos3 . $pos4 . $pos5; $pos1 = $pos2 = $pos3 = $pos4 = $pos5 = ''; } elseif ($is_tax == 'projects') { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); $pos5 .= '<div class="col-md-6 col-sm-6 col-xs-12 clearfix"> <div class="post"> <div class="inner"> <div class="entry-aside"> <header class="entry-header"> <h1 class="entry-title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a> </h1> </header> <div class="divider"></div> <div class="entry-content">'; $pos6 .= !empty($post->post_excerpt) ? '<p>' . $post->post_excerpt . '</p>' : '<p>' . strip_tags(tfuse_shorten_string(apply_filters('the_content', $post->post_content), 50)) . '</p>'; $pos7 .= '</div> </div> <div class="post-thumbnail">'; if (!empty($image)) { $pos8 .= '<a href="' . get_permalink($post->ID) . '" class="post-thumbnail-image"><span>' . __('More', 'tfuse') . '</span></a> <img src="' . $image . '" alt="' . $post->post_title . '">'; } $pos9 .= '</div> </div> </div> </div>'; $pos = $pos5 . $pos6 . $pos7 . $pos8 . $pos9; $pos5 = $pos6 = $pos7 = $pos8 = $pos9 = ''; } elseif ($is_tax == 'category') { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); $art_type = tfuse_page_options('article_type', '', $post->ID); if (!empty($image)) { if ($art_type == 'post-style-4' || $art_type == 'post-style-3') { $image = TF_GET_IMAGE::get_src_link($image, 270, 380); } elseif ($art_type == 'post-style-1' || $art_type == 'post-style-2') { $image = TF_GET_IMAGE::get_src_link($image, 269, 267); } } $user_data = get_user_by('id', $post->post_author); $pos11 .= '<article class="post ' . $art_type . '"> <div class="entry-aside"> <header class="entry-header">'; if ($art_type != 'post-style-7') { if (!empty($image)) { $pos12 .= '<div class="post-thumbnail"> <a href="' . get_permalink($post->ID) . '" class="post-thumbnail-image"> <span>' . __('More', 'tfuse') . '</span> </a> <img src="' . $image . '" alt=""> </div>'; } } $pos13 .= '<div class="entry-meta"> <time class="entry-date" datetime="">' . get_the_time($d, $post->ID) . '</time> <span class="author"> ' . __('by ', 'tfuse') . '<a href="' . get_author_posts_url($post->post_author, $user_data->data->user_nicename) . '">' . $user_data->data->user_nicename . '</a></span> <span class="cat-links"> ' . __('in', 'tfuse') . ' ' . tfuse_cat_links($post->post_type, $post->ID) . '</span> <h2 class="entry-title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h2>'; if ($art_type == 'post-style-7') { if (!empty($image)) { $pos14 .= '<div class="post-thumbnail"> <a href="' . get_permalink($post->ID) . '" class="post-thumbnail-image"> <span>' . __('More', 'tfuse') . '</span> </a> <img src="' . $image . '" alt=""> </div>'; } } $pos15 .= '</div> </header> <div class="entry-content">'; $pos16 .= !empty($post->post_excerpt) ? '<p>' . $post->post_excerpt . '</p>' : '<p>' . strip_tags(tfuse_shorten_string(apply_filters('the_content', $post->post_content), 50)) . '</p>'; $pos17 .= '</div> <footer class="entry-meta clearfix"> <a href="' . get_permalink($post->ID) . '" class="btn btn-yellow btn-read-more"><span>' . __('Read More', 'tfuse') . '</span></a> <a href="' . get_permalink($post->ID) . '#comments" class="btn btn-transparent link-comment"><span>' . $comments . '</span></a> </footer> </div> </article>'; $pos = $pos11 . $pos12 . $pos13 . $pos14 . $pos15 . $pos16 . $pos17; $pos11 = $pos12 = $pos13 = $pos14 = $pos15 = $pos16 = $pos17 = ''; } elseif ($is_tax == 'search') { $img = tfuse_page_options('thumbnail_image', null, $post->ID); if (tfuse_options('disable_listing_lightbox')) { $image = '<a href="' . $img . '" rel="prettyPhoto[gallery' . $post->ID . ']"> <img src="' . $img . '" height="200" width="220" alt=""> </a>'; } else { $image = '<a href="' . get_permalink($post->ID) . '"><img src="' . $img . '" height="200" width="220" alt="" ></a>'; } $pos1 .= '<div class="post-item clearfix"> <div class="post-image">' . $image . '</div> <div class="post-meta">'; if (tfuse_options('date_time')) { $pos2 .= '<span class="post-date">' . get_the_time($d, $post->ID) . '</span> | '; } $pos3 .= '<a href="' . get_comments_link($post->ID) . '" class="link-comments">' . $comments . '</a> </div> <div class="post-title"> <h3><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h3> </div> <div class="post-descr entry"> <p>' . strip_tags(tfuse_shorten_string(apply_filters('the_content', $post->post_content), 30)) . '</p> </div> <div class="post-more"><a href="' . get_permalink($post->ID) . '">' . __('READ THE ARTICLE', 'tfuse') . '</a></div> </div>'; $pos = $pos1 . $pos2 . $pos3; $pos1 = $pos2 = $pos3 = ''; } $allpos[] = $pos; } $rsp = array('html' => $allpos, 'items' => $items, 'posts' => $posts); echo json_encode($rsp); } die; }
function tfuse_shortcode_latest_entry($atts, $content = null) { $out = ''; $recent_post = wp_get_recent_posts(array('numberposts' => 1)); if (!empty($recent_post)) { foreach ($recent_post as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post['ID'], 'post-thumbnails')); $get_image = new TF_GET_IMAGE(); $img = $get_image->properties(array('class' => '', 'alt' => get_the_title($post['ID'])))->width(210)->height(210)->src($image)->resize(true)->get_img(); $current_post = get_post($post['ID']); $out .= ' <div class="home-post"> <div class="inner"> <div class="entry-aside"> <header class="entry-header"> <div class="entry-meta"> <div class="cat-links"> <a href="' . get_permalink($post['ID']) . '">' . __('Latest blog entry', 'tfuse') . '</a> </div> <time class="entry-date"><i class="icon-circle"></i>' . get_the_time(get_option('date_format'), $post['ID']) . '</time> <h1 class="entry-title"> <a href="' . get_permalink($post['ID']) . '">' . get_the_title($post['ID']) . '</a> </h1> </div> </header>'; if (!empty($image)) { $out .= '<a class="post-thumbnail" href="' . get_permalink($post['ID']) . '">' . $img . '</a>'; } $out .= '<div class="entry-content"> <p>'; if (tfuse_options('post_content') == 'content') { $out .= $current_post->post_content; } else { $out .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $out .= '</p> </div> <footer class="entry-meta"> <a href="' . get_permalink($post['ID']) . '" class="btn btn-transparent btn-lets-talk"><span>' . __('Read article', 'tfuse') . ' <i class="icon-chevron-right align-right-icon"></i></span></a> </footer> </div> </div> </div>'; } } return $out; }