function single_last_blog($categoryid) { global $wpdb; $f_content = ''; $args = array('showposts' => 1, 'orderby' => 'date', 'order' => 'DESC', 'cat' => $categoryid, 'author' => all_experts()); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $avtor = get_the_author_meta('ID', $post->post_author); $user = get_userdata($avtor); $posada = get_field('posada', 'user_' . $user->ID); $author_posts_url = get_author_posts_url($user->ID); $f_content .= '<div class="gray-bg">'; $f_content .= '<div class="padding top-blog"> <div class="day">' . get_the_date('j.m.Y') . '</div> <div class="title"><a href="' . get_the_permalink() . '" >' . trim_title_chars(45, '...') . '</a></div> </div> <hr /> <div class="img_wrapper padding"> <img src="' . author_img($user->ID) . '" alt="' . $user->user_firstname . ' ' . $user->user_lastname . '" /> </div> <div class="clearfix"></div> <hr /> <div class="padding"> <div class="blog--fio"> <a href="' . $author_posts_url . '">' . $user->user_firstname . ' ' . $user->user_lastname . '</a> </div>' . $posada . '</div>' . comments($post->ID) . '<a class="blog-more" href="' . get_the_permalink() . '" ><i class="sprite-arrow-right"></i> <span id="ua">Детальніше</span><span id="en">More</span></a></div>'; } } wp_reset_postdata(); $f_content .= '<div class="clearfix"></div>'; return $f_content; }
<div class="block clearfix"> <div class="preview imgLiquidFill" > <img src="<?php the_field('preview'); ?> " /> </div> <div class="info"> <a href="<?php the_field('link'); ?> " target="_blank" class="title" onClick="woopra.track('News & features - Featured Articles', { Block: 'News & features', Element: 'Featured Articles', Title: '<?php the_title(); ?> ' })"><?php trim_title_chars(50, '...'); ?> </a> <p><?php content('20'); ?> </p> </div> </div> <?php } ?> <?php wp_reset_postdata(); ?>