\n"; $custom_query = new WP_Query( array( 'post_type' => 'post', 'posts_per_page' => 1, 'post_status' => 'publish', ) ); if ( $custom_query->have_posts() ) { // echo "\n"; while ( $custom_query->have_posts() ) { // echo "\n"; $custom_query->the_post(); $post = get_post(); /* echo "\n"; */ // $url = get_permalink($post->ID); $url = get_permalink(); $title = get_the_title($post->ID); // echo "\n"; $content = wp_seo_get_description($post); // echo "\n"; $keys = wp_seo_get_keywords($post); echo "\n"; $image = false; if ( get_attached_media('image') ) { $image = array_shift(get_attached_media('image')); $image = $image->ID; } if (! $image) { $image = get_post_thumbnail_id(); } if ( $image ) { $full = wp_get_attachment_image_src($image,'full'); return [$full, $url, $title, $content, $keys]; } } } wp_reset_postdata(); return [$image, $url, $title, $content, $keys]; } /* get_header(); */ ?> >