• Resolved Gene

    (@gene158)


    Hi, I’m trying to use your plugin with WP Review Pro but am running into an issue…

    I’m using your customization code to change the output display of the store results so that I can include the star ratings from WP Review Pro.

    I’ve added the function to my child theme’s function.php file, I’m trying to run their shortcode [wp_review_pro id=”X”] and I’m trying to include your store ID number but it’s not working…

    I’m using this code but it doesn’t work…

    echo do_shortcode(‘[wp_review_total id='<%= id %>’]);

    I also tried to store the id as a variable with no luck…

    $store_id = <%= id %>;
    echo do_shortcode(‘[wp_review_total id=’.$store_id.’]);

    Any ideas on how I can get this work? Any help is much appreciated! Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Gene

    (@gene158)

    So after much googling, I don’t think it will work with using <%= id %> in PHP. Is there a function I can use to get the store ID so that I can use it with WP Review Pro’s shortcode for displaying the star rating? Their shortcode requires the store ID to work properly.

    [wp_review_total id=”1″]

    If it’s not possible, can suggest another star rating plugin that could work with your plugin?

    Thanks again!

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Not sure if this will work, but you can try something like this.

    First of all, don’t echo the shortcode output, but store it in a var.

    You can use this to include it in the returned store location data, which you can do with this filter ( it already passes the store ID ).

    So in the custom_store_meta function, you can grab the data from the WP Review plugin. Store it in a var, and then do something like this:

    
    $store_meta['review_data'] = 'your review data';
    

    Then in the template code itself you can add it with this filter, by accessing the review_data key in the template.

    This is all untested, but this is how I would try it.

    Thread Starter Gene

    (@gene158)

    THANK YOU!!!! I’ve been working on this one for awhile, so glad to finally have it work now.

    add_filter( 'wpsl_store_meta', 'custom_store_meta', 10, 2 );
    function custom_store_meta( $store_meta, $store_id ) {
        
        $wp_review_star = do_shortcode('[wp_review_total id=' .$store_id. ']');
        $store_meta['review_data'] = $wp_review_star;
        
        return $store_meta;
    }

    Then I displayed it using the custom listing template filter

    <%= review_data %>

    And I just purchased your CSV manager add-on. Thanks again, really appreciate it!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Integrate with WP Review Pro Plugin’ is closed to new replies.