Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
992 B
1
Indexable
Never
function Lastposts($a)   {
    $args = array( 'posts_per_page' => $a);
    $last_3_posts_query = new WP_Query( $args );
    while($last_3_posts_query->have_posts()) : 
        $last_3_posts_query->the_post();
        $link = get_permalink();
        $title = get_the_title();
        $date = get_the_date();      
        $excerpt = get_the_excerpt();   
        $thumbnail = get_the_post_thumbnail();  
        $tags = get_the_tag_list();
        $content .= '<div class="item">';
        $content .= '<div class="thumbnail"><a href='.$link.'>' .$thumbnail. '</a></div>'; 
        $content .= '<div class="post-text"><h4 class="post-title"><a href='.$link.'>'.$title.'</a></h4>';
        $content .= '<div class="post-excerpt">'.$excerpt.'</a></div>';
        $content .= '<a class="read-more" href='.$link.'><span class="read-more">CZYTAJ WIĘCEJ</span></a>';
        $content .= '<div class="tags">'.$tags.'</div></div>';
        $content .= '</div>';
    endwhile;

re