Custom Fields

Posted in: Newspaper
Post count: 8

We use a third-party editing software to push our content to WordPress and would like to use the nice ‘format’ and ‘featured video’ features you include in the ‘edit post backend’.

Is there a way we can use a ‘custom field’ to toggle the format to ‘video’ and add the url to ‘featured video’.

For instance we would love to have a ‘custom field’ = ‘video_url’ that takes in a youtube url. When there is a URL present in the custom field, it would switch the ‘format’ = ‘video’ and add the ‘URL’ = ‘featured video’.

Thank you in advance for your help with the complicated task.

Post count: 6600

Hi,

You can use Advanced Custom Fields plugin, please follow this topic: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-8993
Hope this helps!

Thanks

Post count: 8

Hello,

We have gotten really close to what we need to do, but it still isn’t quite working.

It appears that we can create a custom field called ‘td_post_video’ and put the video url we want in there, but after updating the post the “Featured Video” box only contains the first character of what we put in the custom field, usually ‘h’ instead of ‘http://youtu.be/video’

We also tried ‘td_post_video[td_video]’ and ‘td_video’ but those did not work either. Are we using the correct post meta key?

Post count: 6600

Hi,

You can take a look here to see how this is made and try something similar: http://screencast.com/t/Qn3lq8QfBCz
Hope this helps!

Thanks

Post count: 8

Is there a module that gets called when a post is created that I could insert something like the following to set the video url from the custom field:

$newVideoUrl = get_post_meta($this->post->ID, video_url, true);
if (empty($td_post_video[‘td_video’]) && !empty($newVideoUrl)) {
$td_post_video[‘td_video’] = $newVideoUrl;
}

Post count: 6600

Hi,

You have to look for a hook and create a function which sets the post format to video.
You can use the set post format function: http://codex.wordpress.org/Function_Reference/set_post_format

Hope this helps!
Thanks

  • This reply was modified 11 years by Lucian.
Post count: 8

Ok, we have gotten it to a point where it sets the post type to video and sets the td_post_video[td_video] to the custom field’s data. The video appears correctly in the post, but it is not creating the “featured image” automatically as it would when you put the url in on the wordpress backside. Do we need to add something to call the function to create the image from the video url and set it as image for the post?

Post count: 6600

Hi,

Please modify this function also to get the custom filed data: http://screencast.com/t/eR0K8wTD7xS

Thanks

Viewing 8 posts - 1 through 8 (of 8 total)
The forum ‘Newspaper’ is closed to new topics and replies.