Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author jhanbackjr

    (@jhanbackjr)

    Hello, sohaaib.

    Thanks for trying GoodReviews. If you just want to include the data on a page, the recommended method is to use a shortcode inside the page rather than using PHP. Using the shortcode is explained here:

    https://www.ads-software.com/plugins/goodreviews/faq/

    However, if you must use PHP instead of directly using the shortcode, you can do so by calling the WordPress do_shortcode() function, as described here:

    https://developer.www.ads-software.com/reference/functions/do_shortcode/

    Hope that helps. Let me know if I can be of further assistance.

    James

    Thread Starter sohaaib

    (@sohaaib)

    Thanks for the reply. Sir i need to use goodreviews plugin on this website https://booksforchange.se/shop/ankle-shoes/ in review section to show goodreads review instead of woocommerce plugin reviews.Is it possible?

    Plugin Author jhanbackjr

    (@jhanbackjr)

    Hi, sohaaib.

    Your site is a WordPress site, so you should be able to use GoodReviews by either issuing the shortcode or by using the do_shortcode() WordPress PHP function. I have no experience with WooCommerce, so I cannot say for certain what specific changes you might need to make to get the plugin to work there. You can test the plugin by pasting the following code on a page on your site:

    [goodreviews isbn="0000000000000" height="500" width="500" border="On"]

    Replace 0000000000000 with the ISBN for one your books.

    If you need to use the PHP version, you should be able to do something like the following (untested):

    <?php echo do_shortcode('[goodreviews isbn="0000000000000" height="500" width="500" border="On"]');?> where 0000000000000 is the ISBN for one of your books.

    Hope that helps.

    James

    Thread Starter sohaaib

    (@sohaaib)

    Sir i wanna add plugin code in this code:

    add_filter( ‘woocommerce_product_tabs’, ‘woo_custom_description_tab’, 98 );
    function woo_custom_description_tab( $tabs ) {

    $tabs[‘description’][‘callback’] = ‘woo_custom_description_tab_content’; // Custom description callback

    return $tabs;
    }

    function woo_custom_description_tab_content() {
    echo ‘<h2>Custom Description</h2>’;
    echo ‘<p>Here\’s a custom description</p>’;
    }

    Plugin Author jhanbackjr

    (@jhanbackjr)

    Hello, sohaaib.

    Have you tried the following?

    function woo_custom_description_tab_content() {
             echo do_shortcode('[goodreviews isbn="0000000000000" height="500" width="500"]');
    }

    You will need to replace 0000000000000 with the correct ISBN.

    Hope that helps. I have no experience with WooCommerce, so I cannot guarantee that the above code will work. It is untested.

    James

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP code for plugin’ is closed to new replies.