qtranslate-slug
qtranslate-slug copied to clipboard
Custom RSS feed for custom post type not working with qtranslate-slug plugin
There is some issue with custom rss feed after installing "qtranslate-slug" plugin. I customised rss feed url to include my custom post type. I added custom post type into standard feed URL ex. http://www.example.com/feed/?post_type=custom_post_type
and in function.php
apply a hook to handled custom template for rss feed like below -
remove_all_actions('do_feed_rss2'); add_action('do_feed_rss2', 'custom_feed_rss2', 10, 1); function custom_feed_rss2($for_comments) { $rss_template = get_template_directory() . '/feed_custom_post_type.php'; if (get_query_var('post_type') == 'custom_post_type' && file_exists($rss_template)) load_template($rss_template); else do_feed_rss2($for_comments); // Call default function }
As you look into code, i tried to get query string value using get_query_var('post_type')
; but it's returning empty string. Also in template feed_custom_post_type.php
i didn't get all post for this post type.
Can you please help me to resolve this problem? A bunch of thanks in advance...!!!