Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Auto thumbnail

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #28855
    EamonnMac
    Member

    Hey duderinos,

    I’ve bashed and crowbar-ed the following together: when you create a WP post, you may want to use a thumbnail image somewhere – beside the title, for example.

    You can do this using a custom field of course, but with the following if you don’t specify a thumbnail image to use then the first image you associate with that post will then automatically become the thumbnail instead.

    Code:
    get_var(“SELECT ID FROM $wpdb->posts WHERE post_parent = ‘$post->ID’ AND post_status = ‘inherit’ AND post_type=’attachment’ ORDER BY post_date ASC LIMIT 1”); ?>

    ID, ‘thumbnail’, true);
    if($thumbpath ==””) {
    $thumbpath = $attachment_image;
    }
    ?>

    ///USAGE///

    Author
    Posts
Viewing 1 post (of 1 total)
  • The forum ‘Other’ is closed to new topics and replies.