Video sitemaps for custom posts and/or custom fields
-
I have tried and tested the video sitemap plugin, but it doesn’t generate output in sitemap-video.xml
My guess is that a lot of issues people are experiencing is related to the use of custom post types and/or placing the embed-code in an alternative (meta-)field. All webadmins should be able to discern if they embed their videos on a custom page template. In order to check what the name of the field is, in which you place your embed code, I recommend to make use of the ‘Post Meta Inspector’-plugin.
This plugin doesn’t support both of the above scenario’s!
And now for (part) of the solution…In the file ‘plugin.php’ that is included in the plugin-folder, we can find the database retrieval on line 101.
$posts = $wpdb->get_results ("SELECT id, post_title, post_content, post_date_gmt, post_excerpt // defines the fields to be retrieved and parsed FROM $wpdb->posts, $wpdb->postmeta // make the selection from the 'posts' and 'metadata' table WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id // synchronise selections from both tables by post ID AND $wpdb->posts.post_status = 'publish' // check if the post has been published AND $wpdb->posts.post_type = 'videos' // in my case, the custom post type is videos AND $wpdb->postmeta.meta_value LIKE '%youtube.com%' // in my case, the embed code is placed in the meta_value field ORDER BY post_date DESC"); // a reversed chronological sort
I have insuffiencient code experience to find any error, but I know I am missing something. Can anyone, or the plugin author, help to make this plugin (more) applicable?
(implementation needs to be done on selfdestination.com)
- The topic ‘Video sitemaps for custom posts and/or custom fields’ is closed to new replies.