• Please forgive me but I have searched in all the obvious places and can’t seem to find any instructions on how to add GD Star Ratings direct to my theme’s template files.

    There was this on the official site

    How to insert rating blocks or results directly into the theme files?
    All plugins functions for inserting wherever you want can be found in the info folder included with the plugin, or at this url: https://info.dev4press.com/gd-star-rating/.

    But that url no longer exists.

    Any help would be greatly appreciated as I just need to add a basic star rating to my template file so I can position a bit better than it currently is.

    Thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter greencode

    (@greencode)

    Can anyone help with this – all I really need is a list of the available functions so I can add the ratings direct to the theme template file. I can’t find anything anywhere though ;-(

    same problem here.. so hard to find working examples with this plugin!
    will have a look around.

    Thread Starter greencode

    (@greencode)

    I’ll continue the hunt too. I remember I did some development over a year or so ago and found stuff pretty easily but as that link doesn’t work I’m now a bit confused as to where to find functions and examples. Let me know whether you find anything. I will too.

    ok found this and added it to the sidebar and got the blog rating where i wanted it..

    <?php if(function_exists(‘wp_gdsr_render_article’)) { wp_gdsr_render_blog_rating_widget(array(‘template_id’ => 14)); } ?>

    you can find these functions in GD Star Rating – Builder – functions box. like so..
    wp_gdsr_render_blog_rating_widget(array(‘template_id’ => 14));

    just adding them in between this worked for me…
    <?php if(function_exists( } ?>

    good luck

    Thread Starter greencode

    (@greencode)

    Ah ha, thanks for this – not exactly the most obvious thing in the world!

    dskvr

    (@dskvr)

    Thanks for this, just encountered the exact same problem. Documentation for this plugin has been confusing and difficult to find for some time now. It’s the best in terms of functionality, but whenever I have to dig into documentation I begin to get chest pains. To: Millan (if you ever read this), the GDStarRating.com site has always been in the wrong format. It is very difficult to locate things. Please make this easier.

    Same issue – the link to documentation is broken – Millan, if you read this please update. You could 301 that link to the docs, wherever they are….

    I have found the function reference documentation, it’s actually included with the plugin. GD Star Rating is a great plugin, but I must say I agree with dskvr. It’s been a very long day trying to find everything…

    To access function reference:
    Navigate to GD Star Rating in the sidebar of WP admin, then to “Builder”. At the bottom of the builder there is the following:
    List of all functions with additional parameters:
    Functions

    The word ‘functions’ links to the function reference.

    Even with this information in hand I still struggled to add stars to my theme in the way I wanted to. In this instance I needed to just display small stars with the post’s rating on main pages with excerpts, and not to allow ratings on these pages.

    After digging around on the web for quite some time I found this article:
    https://www.tomauger.com/?p=74

    The following code added into the theme generated stars as required:

    $postRatingData = wp_gdsr_rating_article(get_the_ID());
    gdsr_render_stars_custom(array(
        "max_value" => gdsr_settings_get('stars'),
        "size" => 12,
        "vote" => $postRatingData->rating
    ));

    Thanks Tom Auger!

    You can see the ratings in action below thumbnails on all main pages (not single) at the link below. Settings are as above, with 12px stars.
    https://i.padaccessories.info/tag/ipad-cases/

    Cheers! Great looking site LachlanM, by the way.

    I’ve updated the permalinks (okay, I’ll be honest, I’ve started using permalinks) so I wanted to update the link to that post with its more current permalink just in case.

    By the way, the above post came out of work we were doing on this site, in case anyone wants to see GD Star Ratings in action.

    Glad I was able to help someone out!

    T

    OK! I finally found the very simple answer to this question. LachlanM & tomauger, your information was useful in learning but somehow did not work for my template. I actually got frustrates and typed into google: “how the f#ck do you use gd star rating” and the first result that popped up was a link to an ACTUAL Users Guide!

    https://www.gdstarrating.com/downloads/user-guide/

    On page 15 it has the instructions to put it in a template. Just throw this code on the page where you want it and it comes up:

    <?php wp_gdsr_render_article() ?>

    As far as customizing is concerned, I have no idea. I believe that is what tomauger is doing, I just haven’t studied enough to understand it. I really just want to change the color of the stars in my case and I’m happy…

    I was wondering if anyone knew how to retrieve the multi set rating of a post rather than just the standard rating this code retrieves

    $postRatingData = wp_gdsr_rating_article(get_the_ID());
    gdsr_render_stars_custom(array(
    “max_value” => gdsr_settings_get(‘stars’),
    “size” => 12,
    “vote” => $postRatingData->rating
    ));

    To be clear, I want to “average” multi set rating to appear instead of the normal gdsr rating the code above shows.

    I tried all of different functions in the builder but none seem to work, could someone help me. THANK YOU so much in advance.

    I just upgrade the plugin and my site is broken.

    I was using this:

    <? wp_gdsr_render_article_thumbs ($template_id=0, $read_only=false, $stars_set="", $stars_size=0, $stars_set_ie6="", $echo=true); ?>

    And now nothing loads.

    Can anyone help in how is this supposed to be now for it to work ?

    Thanks.

    I did this:

    <?php if(function_exists('wp_gdsr_render_article_thumbs')) { wp_gdsr_render_article_thumbs(array('template_id' => 45)); } ?>

    And its working.

    Not sure if its the correct way, but maybe helps someone wth the same problem.

    If anyone knows exactly how this should be, please share.

    I had this problem too when I upgraded. I had to go in and change the code in the plugin, but I can’t remember what I did. If you still can output the PHP error message that might help. However, if you now have it working via templates, then maybe you needn’t bother.

    Hi all,

    I have another question concerning this matter.
    Have you tried to add 2 functions (wp_gdsr_render_article) in the same page? What if i want to have 2 ratings that are from the same post in the same page?

    I allready added this but what happens is that when i click on the stars to rate the post (the second onde)…its as if i click on the first one. The rating works but only for one of the post ??

    Can anyone help me with this please?

    Thanks

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: GD Star Rating] Adding directly to theme template file’ is closed to new replies.