</time> <span class="author"> <?php _e('by', 'tfuse'); ?> <?php the_author_posts_link(); ?> </span> <?php if ($post->post_type != 'page') { ?> <span class="cat-links"> <?php _e('in', 'tfuse'); ?> <?php echo tfuse_cat_links($post->post_type, $post->ID); ?> </span> <?php } ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h2> <?php if ($art_type == 'post-style-7') { ?>
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; }