Twitter Tracker widget query: not overwriting on pages
-
Thanks Simon for a great plugin and thank you for making it work with Twitters 1.1 API, I suspect that was quite a lot of work.
I fixed the inability to override / overwrite the default search criteria this for TT Version 3.3.6. The $post_id variable was never getting set and there was a problem with the code to determine under which circumstances using the override should occur.
My code only works for the search, not the Profile tracker (though a similar change would probably suffice) and removes the ability to set a default through the Appearance | Widgets section.
You do this by selecting the Plugin through Plugins | Editor.
Choose the file: twitter-tracker.php if it is not already chosen.
Find the line:
// Allow the local custom field to overwrite the widget's query
After this line enter:
global $post; $post_id = $post->ID; // Get the $post_id of the current page
Then comment out the next line.
This section should now look like this:
// Allow the local custom field to overwrite the widget's query global $post; $post_id = $post->ID; // Get the $post_id of the current page //if ( is_singular() && is_single() && $post_id = get_queried_object_id() ) if ( $local_query = trim( get_post_meta( $post_id, '_tt_query', true ) ) ) $twitter_search = $local_query;
Once your code looks like the above, click Update File, set an override on the Page and this should now work. If you want to do similar with the Profile tracker, there is similar code a bit further down in the file. I’ve not looked hard at it but I suspect you can do a similar thing.
Mat
- The topic ‘Twitter Tracker widget query: not overwriting on pages’ is closed to new replies.