Hi again, I have a special project requiring me to use this plugin in a way I hadn't used before. I need to retrieve youtube results based on the post title and meta_value.
This is how I've normally used the plugin:
[relatedYouTubeVideos relation="postTitle" max="2" width="350" filter="official video" duration="short" height="170"]
I have the plugin within a post. So if the post title is "isn't she lovely by stevie wonder", the video retrieved by this plugin is usually spot on finding the official music video hoped for. With popular videos I can usually retrieve the right one based on the title with or without the filter, but when the post title is of a video not so popular, I have a hard time getting the right video without the year the music video was made.
So again, I'm trying to figure out out how to retrieve videos by the post title and the year the video was release. The post title doesn't contain the year. The year is stored in a meta_value. For example, the isn't she lovely post by Stevie Wonder has the following information:
Post title: Isn't She Lovely
meta_key: release_date
meta_value: 1976
I need the plugin to look for "isn't she lovely 1976"
I just discovered the ability to use the API class outside the plugin context via (https://wordpress.org/plugins/related-youtube-videos/other_notes/). This gives me hope.
Finally, my question is, do you know of a way I can acheive the said goal on single pages (single.php)?
Since <?php echo get_post_meta($post->ID, 'release_date', true) ?>
successfully retreives the desired meta value, I know what I'm hoping for can be done. I just need to figure out how to incorporate this code into the plugin. I'm thinking some varioation of this would work in single.php:
...Only continue if the API class could be loaded properly. */
if( class_exists( 'RelatedYouTubeVideos_API' ) ) {
`$RytvAPI = new RelatedYouTubeVideos_API();
/* Do your configuration */
$data = $RytvAPI->validateConfiguration(
array(
'relation' => 'postTitle',
'max' => '3',
'width' => 150,
'height' => 150,
'terms' => 'echo get_post_meta($post->ID, 'release_date', true) ',
'lang' => 'en',
'region' => 'de',
'class' => 'left center inline bg-black',
'preview' => true
)
);`...
Sorry for any redundancy in this support request. Also, absolutely any way you can think of to achieve the said goal is fine with me, even if it means I have to edit the core code of the plugin, making it only useful for retrieving results based on the postTitle and said meta_value exclusively.
Thanks in advance for any help