WordPress.org

Ready to get started?Download WordPress

Forums

Add enclosures from Custom Field (2 posts)

  1. scottbothel
    Member
    Posted 2 years ago #

    I am working on a custom theme that uses custom post types. I have added a field to upload media and I want to run the do_enclose function on the post. But the post does not contain a link to the media in the post content, just in a custom field.
    Anyone care to offer a hack to the do_enclose function in wp-includes/functions that will look at a custom field rather than the post body?
    I would then run that function when a post with the custom post type was updated.

    Thanks in advance to anyone with the skilz to make this happen!

  2. bcworkz
    Member
    Posted 2 years ago #

    It kind of looks like you can call do_enclose() passing your field value as $content. Failing that, you could write your own function to enclose the link.

    One problem would be if do_enclose() were called with the actual post content by some other process, your enclosure will be removed. Another approach would be to copy the field value to content as hidden text, then call do_enclose in the normal manner.

Topic Closed

This topic has been closed to new replies.

About this Topic