[Support request] Help with a plugin

Home Forums Support [Support request] Help with a plugin

Home Forums Support Help with a plugin

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #978844
    Charalambos

    Hello,

    I have an issue with a plugin and i was hoping you help me sort it out.

    I have installed a review plugin that allows you to show the overall rating at homepage and archives as a thumb in the top right featured picture of the post. Here is their demo page below where you can see how it looks,

    https://demos.codetipi.com/letsreview

    However, as I found out after buying the plugin, to achieve this you need some extra customization. Here is the message I received from the plugin developer,

    “Regarding the posts on the homepage, it’s literally impossible for a plugin to inject content of this type into the archives loop of a theme, as every theme is coded differently. Most won’t even have a way to inject into that location (next to the featured image in the posts loop).

    You will need to ask the maker of your theme for the correct way to inject post meta data into the archives post loop. If you show them the documentation below, they’ll definitely understand what needs to be done and will be able to advise you.”

    https://docs.codetipi.com/lets-review/#api

    Could you please advise if this is possible to be done with Generate press, and if yes how can i do it?

    regards

    Pambos

    #978935
    David
    Staff
    Customer Support

    Hi there,

    you could try this:

    1. Create a new Hook Element
    2. Add this for the content:

    <?php
    global $post;
    if ( class_exists( 'Lets_Review_API' ) ) {
        $my_score_box = Lets_Review_API::lets_review_get_score_box( $post->id );
        echo $my_score_box;
    } else {
        // do nothing
    }
    ?>

    3. Select the before_entry_title hook
    4. Check Execute PHP
    5. Set the Display rules to Blog and Archives.

    Let me know if the content displays i can then take a look at the CSS required for positioning.

    #978945
    Charalambos

    Hello David,

    Just tried this, but it doesn’t work i m afraid

    #978973
    David
    Staff
    Customer Support

    I made slight change to the code above, can you try that and let me know.

    #979123
    Charalambos

    I tried this as well, but nothing changes.

    #979193
    Tom
    Lead Developer
    Lead Developer

    I wonder if the condition is working.

    Can you try this?:

    <?php
    global $post;
    if ( class_exists( 'Lets_Review_API' ) ) {
        $my_score_box = Lets_Review_API::lets_review_get_score_box( $post->id );
        echo $my_score_box;
        echo 'hi';
    } else {
        // do nothing
    }
    ?>

    Does the word “hi” appear?

    #979220
    Charalambos

    Hello Tom,

    Yes it appears below the featured image.

    #979428
    Tom
    Lead Developer
    Lead Developer

    So that means $my_score_box isn’t working properly.

    It might be worth asking their support if we’re using the function correctly. I can’t see why it wouldn’t be working, but I’m not familiar with their plugin, unfortunately.

    #979714
    Charalambos

    Hello Tom,

    Ok, I have send the plugin developer a message linking to this post, so he can have a look at the code we are using.
    Also I don’t know what exactly does he mean or if this helps, but going through the plugin’s support comments, he seems to insist that the function must be inside the loop and also the the api code needs to be inserted wherever the theme outputs the post data.

    #979732
    David
    Staff
    Customer Support

    Do you have the API Code that needs to be inserted?

    #979758
    Charalambos

    Hi,

    But I think you have already used it in your first reply to this post. Here it is again,

    https://docs.codetipi.com/lets-review/#api

    #979759
    David
    Staff
    Customer Support

    Was checking to see if there was any other code the plugin author supplied. Best check with them to see whats missing.

    #979773
    Charalambos

    Hello,

    I have been searching his support comment forum and found an answer he gave with some other codes. Again I don’t know if this helps, but I copy his answer below,

    For anyone else wondering, there is an easier way to get the scores data via the plugin’s API, you probably need a bit of developing knowledge (or if you can reverse-engineer it all) you could use this instead:

    First you need to be inside a loop (the code of whatever “blog style” generates your lists of post is a loop), you could get the scores using this:

    if ( class_exists( ‘Lets_Review_API’ ) ) {
    $lets_review_api = new Lets_Review_API();
    if ( $lets_review_api->lets_review_get_onoff( $post->ID ) == false ) { return; }
    $final_score = $lets_review_api->lets_review_get_final_score( $post->ID );
    $color = $lets_review_api->lets_review_get_color( $post->ID );
    // Output the variables here depending on how your theme is outputting each post in your blog style
    }

    And now you have the final score assigned to ”$final_score” and the color (in case you want to use that outside of the post too) in a variable called ”$color”.

    #979787
    David
    Staff
    Customer Support

    Add this code to the hook instead:

    <?php
    global $post;
    if ( class_exists( 'Lets_Review_API' ) ) {
        $lets_review_api = new Lets_Review_API();
        if ( $lets_review_api->lets_review_get_onoff( $post->ID ) == false ) { return; }
        $final_score = $lets_review_api->lets_review_get_final_score( $post->ID );
        $color = $lets_review_api->lets_review_get_color( $post->ID );
        // Output the variables here depending on how your theme is outputting each post in your blog style
        echo $final_score;
    } else {
        // do nothing
    }
    ?>
    #979870
    Charalambos

    Just to clarify. I should delete the previous code added in the hook and replace with this one. Also shall i change something where it says,
    // Output the variables here depending on how your theme is outputting each post in your blog style

Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.