Tag Info

Hot answers tagged

3

It seems GD Star Rating uses get_query_var() to read query variables, which only reads this global $wp_query variable. query_posts() overwrites the global $wp_query variable, so it works there, but creating a new WP_Query (which is a good practice) will not work. You should contact the plugin author and ask for a fix.


3

The posts_where filters the 'WHERE' part of the SQL statement, and not the query string. So $where .= "&post_date > '".date('Y-m-d H:i:s', strtotime('-24 hours'))."'"; should be $where .= " AND post_date > '".date('Y-m-d H:i:s', strtotime('-24 hours'))."'"; Also as this hook is fired for every query (admin and public side), you should use ...


2

The plugin supports this feature by default. Searching for "gd star ratings custom images" finds lots of information including this guide on the official site. Apparently the GD Stars User Guide contains full instructions on creating new image sets as well as some pre-built ones you can use.


2

After some googling and trial and error, here is the solution: add_action("gdsr_vote_thumb_article", "cubepoints_vote_up_down", 10, 4); function cubepoints_vote_up_down() { global $bp; cp_points('star_rating', cp_currentUser(), 1, $data); } add_action('cp_logs_description','cp_admin_logs_desc_star_rating', 10, 4); function ...


2

There is an option for this in the article rating settings. I was using thumbs so hadn't spotted it.


2

From this page, you can see that gdsr_vote_rating_article is the hook you need - it gets called when a post rating is saved.


1

First 2 results on googling for "gd star rating sort posts by rating' are: How to Sort Post by Gd Star Rating Mirror How to reorder posts Mirror Few examples: query_posts("gdsr_sort=rating"); query_posts("gdsr_sort=review&sort_order=asc"); query_posts("gdsr_sort=rating&gdsr_multi=3"); ...


1

gdsr_ftvmin=1 is probably the query parameter you need


1

You should install the plugin and reference it inside of a function within your theme. Be sure to check to make sure the expected plugin/function actually exist. Then you can just use it's functionality as you see fit!


1

there are varaiables in gd rating to sort query. you can use in URL like : http://www.gdstarrating.com/?gdsr_sort=rating&gdsr_order=desc http://www.gdstarrating.com/?gdsr_sort=review&gdsr_order=desc http://www.gdstarrating.com/category/tutorials/?gdsr_sort=votes&gdsr_order=asc or pass to a query query_posts("gdsr_sort=rating"); ...


1

i wrote this plugin a while back for a client and never got around to polishing it off for general release. https://github.com/dwenaus/bp-rate-vote-like-anything Myself and another developer plan to launch it soon. But even as it is now, it's totally solid and very cleanly coded. I wrote it because GD Star Rating plugin was so bloated. Basically it ...


1

You need to add the global $wpdb reference and also add the second parameter required for prepare(): global $wpdb; $post_id = $post->ID; $reviewScore = $wpdb->query( $wpdb->prepare( "SELECT review FROM {$wpdb->prefix}gdsr_data_article WHERE post_id = %d", $post_id ) );


1

Very rough but if you want to add the image when this-- get_post_meta($row->post_id, $widget["image_custom"], true);-- is empty, the following should do it. You need to change test_meta to whatever $widget["image_custom"] is. function alter_meta_wpse_106998($a, $object_id, $meta_key, $single) { if ('test_meta' === $meta_key) { $meta_type = ...


1

Change this: else if ($widget["image_from"] == "custom") { $post_custom_id = get_post_meta($row->post_id, $widget["image_custom"], true); $row->image = get_bloginfo('url')."/scripts/timthumb.php?src=".get_bloginfo('url')."/wp-content/uploads/".get_post_meta($post_custom_id,"_wp_attached_file",true)."&h=70&w=55&zc=1"; ...


1

Add the attribute to each line of code that creates an img tag. In your text editor, search for lines that contain the string "<img". Lines 241 and 273: $row->item_trend_rating = sprintf('<img class="trend" src="%s" style="%s" width="%s" height="%s"></img>', $gdsr->e, $image_bg, $set_rating->size, $set_rating->size); Becomes: ...


1

Cilvic's advice works for me. Just set the GET parameters before using WP_Query. $_GET['gdsr_sort'] = 'rating'; $_GET['gdsr_order'] = 'desc';


1

Untested as I don't have the plugin installed. But I'd say this would be a better way to do it rather than using query_posts() global $wp_query; // Get the existing query and add in extra query args $query = array_merge( $wp_query->query, array( 'gdsr_sort' => 'thumbs', 'posts_per_page' => 10 ) ); // Apply our filter add_filter( 'posts_where', ...


1

Turns out the same functionality can be achieved with wp_gdsr_render_article() if you set it to read only



Only top voted, non community-wiki answers of a minimum length are eligible