Featured image from FTP, Dropbox or local folder?

Home Forums TurboCSV Support Featured image from FTP, Dropbox or local folder?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11609
    billboardsavant
    Participant

    Hi Chris,

    I’ve been using TurboCSV for a few years now and want to thank you in advance for the time you’ve invested in maintaining and updating the plugin!

    I’m not sure if this is curently possible, but one feature that would really help with my setup is the ability to upload and set featured images from outside of the media library – specifically from images uploaded via FTP to a separate “images” folder, from a cloud folder like Dropbox or from a local folder on my CPU. My theme uses a hard-coded image attachment function that only registers featured images when set through the post/page editor, so after running an import using your plugin I have to manually upload the featured images for each post or page.

    For reference, here’s the code snippet that registers this feature in my function.php: http://pastebin.com/3M8uKYxR, and here’s the hook in my single.php that executes the function: http://pastebin.com/U7VBfixG.

    Basically any existing images in my media library are useless for setting featured images in new posts, so I’m hoping that bypassing the library and using an external folder will register any imported images to the specific post/page to get the featured image to work.

    FYI – I’ve only tested using images already uploaded to the media library, which does set the featured image thumbnail on category pages, but doesn’t populate within the image container on a single post page.

    Hope this makes sense and that you might have a solution or future plans to add this funcitonality.

    Thanks!

    #11610
    Chris
    Keymaster

    Hi,

    I don’t have a solution for you, since this is specific to your theme/setup.  I can give you some background information and a suggestion.

    WordPress saves images in the media library as an “attachment” post type with the meta key “_wp_attached_file” set to the file name (relative to the WordPress ‘upload’ directory).   Featured images are assign by setting meta key “_thumbnail_id” of the parent post to the attachment post’s ID.

    I’m not clear on how your theme attaches images to the post, but from the code it looked like it creates image attachment posts and assigns post_parent to the main post.

    Maybe you could use a filter or action to create those attachments?  For example,

    1. FTP the images to your directory (much like you would normally upload them to the media library).

    2. Place the file name(s) to be attached into a custom field for each post.

    3.  During import, as each post is created the “added_post_meta” action will fire for that custom field.  Call the theme’s attachment function from that action.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.