• Resolved simab

    (@simab)


    How can I show the reviews form and reviews in all posts?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    If you mean “on all WooCommerce Products”, then enable the WooCommerce integration in the Site Reviews settings.

    If you mean, “on all WordPress Posts”, then use the WordPress Site Editor to edit the template used for Single Post pages.

    Thread Starter simab

    (@simab)

    Thank you for feedback

    I mean how can I use php code in theme function.php to show review form in all posts-pages.

    Plugin Author Gemini Labs

    (@geminilabs)

    If you are using an old theme that does not support the WordPress Site Editor, the recommended way to do this is to create a child theme and create/modify the single.php and page.php files.

    If you want to use your functions.php file, you could also do something like this:

    function glsr_add_review_form_to_posts_and_pages ($content) {
    global $post;
    if (!$post instanceof \WP_Post) {
    return $content;
    }
    switch ($post->post_type) {
    case 'post':
    case 'page':
    return $content.'[site_reviews_form assigned_posts="post_id"]';
    default:
    return $content;
    }
    }

    add_filter('the_content', 'glsr_add_review_form_to_posts_and_pages');
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.