function galausehat_all_posts($pos = 'all') { if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } if ($pos == 'terkini') { $query = array('post_type' => 'post', 'orderby' => 'post_date', 'order' => 'DESC', 'ignore_sticky_posts' => true, 'paged' => $paged); } elseif ($pos == 'popular') { $time = 'all'; $query = array('post_type' => 'post', 'meta_key' => '_count-views_' . $time, 'orderby' => 'meta_value_num', 'ignore_sticky_posts' => true, 'paged' => $paged); } else { $query = array('post_type' => 'post', 'orderby' => 'post_date', 'order' => 'DESC', 'ignore_sticky_posts' => true, 'paged' => $paged); } $allpost = new WP_Query($query); if ($allpost->have_posts()) { while ($allpost->have_posts()) { $allpost->the_post(); $url = catch_post_image(true, $post->ID, $post->post_content); $ctgr = get_the_category($post->ID); ?> <div class="postscroll"> <div class="grid col-md-4 col-sm-6"> <article class="card"> <a href="<?php echo esc_url(get_permalink()); ?> " class="holder"> <div class="cover" style="background-image: url(<?php echo $url; ?> );"></div> <div class="caption"> <?php the_title('<h2>', '</h2>'); ?> <div class="meta"> Oleh <?php the_author(); ?> · <?php echo get_the_date(get_option('date_format')); ?> </div> </div> </a> <div class="category"><?php $ctgr = $ctgr[0]; echo '<a href="' . get_bloginfo('url') . '/category/' . $ctgr->category_nicename . '">'; echo $ctgr->cat_name; echo '</a>'; ?> </div> </article> </div> </div> <?php } } wp_reset_postdata(); }
<?php get_header(); ?> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3&appId=333029946865563"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <?php $url = catch_post_image(true, $post->ID, $post->post_content); ?> <section class="page"> <header class="row-table" style="background-image: url(<?php echo $url; ?> );"> <?php wp_reset_postdata(); ?> <div class="col-cell"> <div class="container"> <div class="row"> <div class="col-sm-10 col-sm-offset-1"> <?php the_title('<h1>', '</h1>'); ?>
?> " alt="<?php the_title(); ?> " /></a> <?php } else { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " ><img src="<?php echo catch_post_image(); ?> " title="<?php the_title(); ?> " alt="<?php the_title(); ?> " /></a> <?php } ?> </div> <p><?php echo wpyou_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 250, "..."); ?>