Get first post WORDPRESS tutorial
Edit your functions.php of your themes. This also work on amp plugin (wp AMP ninja) -> Edit on functions.php too. Codes 1: <?php /* These functions are great for WordPress sites with posts and media that have been imported. Some images are featured images, some in the content itself, and of the content images, some are internal, others external. These images are grabbed to use at the correct size for archive/homepage thumbnails*/ 1) Look for featured image, show if present 2) Otherwise look for the first image in the content (whether internal or external) 3) Check for an attachment ID, if present, show image at correct dimensions 4) Otherwise show image at normal URL $size = post thumbnail / custom image sizes $url = return a URL or full image tag */ /*Find the image id from a URL*/ function url_get_image_id($image_url) { global $wpdb; $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';