Skip to content

Template Element Rendering Actions โ€‹

This is the primary "customize the output" seam. Each template renders through a family of action hooks. Every hook has a default handler in core (app/Hooks/actions.php) and a richer override in Pro โ€” which is exactly how Pro upgrades the free templates. Hook the same action to replace or augment a single piece of output without touching the template.

How to override a single element โ€‹

Pattern โ€” remove the core default, add your own on the same hook
php
add_action('wp_social_reviews_loaded_v2', function () {
    // Replace the reviewer avatar output in review templates
    remove_all_actions('wpsocialreviews/reviewer_image');
    add_action('wpsocialreviews/reviewer_image', function ($review) {
        echo '<img class="wpsr-avatar" src="' . esc_url($review['reviewer_img']) . '" alt="" />';
    });
});

TIP

Prefer targeting a specific callback with remove_action() (passing the exact handler) over remove_all_actions() when you want Pro's other enhancements to remain.

Reviews โ€‹

Reviews element hooks

reviews_template_item_wrappers_before / _after, reviewer_image, reviewer_name, reviewer_rating, review_platform, review_date, review_content, review_title, review_images, review_ai_summary_list, render_ai_summary_total_reviews, author_position, author_website_logo, render_reviews_template_business_info, render_reviews_write_a_review_btn, reviews_template_wrapper_start / _end.

Registered in: app/Hooks/actions.php ยท Fired in: Views/public/reviews-templates/* (all hooks are prefixed wpsocialreviews/).

Testimonials โ€‹

wpsocialreviews/review_video Pro 4.4.0 โ€” The testimonial video block

When it runs: Fired in the Pro testimonial templates, immediately after wpsocialreviews/review_images and before the review header. Pro's ReviewsTemplateHandlerPro::renderReviewVideo() is the default handler; it decides between Fluent Player, an iframe, a file player, and a watch link.

Parameters:

  • $template_meta (array): the formatted template settings.
  • $review (object): the review row โ€” note this is an object, not an array, unlike the feed seams above.

Fired in: Pro Views/public/testimonial-templates/testimonial1.php, testimonial2.php

Usage:

php
add_action('wpsocialreviews/review_video', function ($template_meta, $review) {
    if (empty($review->id)) {
        return;
    }
    echo '<figcaption class="wpsr-video-credit">' . esc_html($review->reviewer_name) . '</figcaption>';
}, 20, 2);

Playback itself is tuned through the Fluent Player filters on the Pro filters page.

Twitter / X โ€‹

Twitter element hooks

tweet_author_avatar, tweet_author_info, tweet_author_username, tweet_time, tweet_content, tweet_actions, tweet_image, tweet_video, tweet_external_link, tweet_quoted_status, tweet_retweeted_status, tweeter_profile_banner, tweeter_user_profile_picture / _info / _description / _statistics / _follow_btn, tweeter_user_address.

YouTube โ€‹

YouTube element hooks

youtube_feed_template_item_wrapper_before, youtube_channel_banner / _logo / _name / _statistics / _description / _subscribe_btn, youtube_feed_preview_image / _title / _statistics / _description, youtube_popup_content, youtube_template_wrapper_start / _end, render_youtube_prev_next_pagination.

Instagram โ€‹

Instagram element hooks

instagram_feed_template_item_wrapper_before, instagram_post_media / _caption / _statistics, instagram_icon, instagram_user_avatar, instagram_header_statistics, instagram_follow_button, instagram_shoppable_button / _icon, instagram_post_author, instagram_post_date.

Since 4.5.0, core has its own handlers on instagram_follow_button and instagram_header_statistics, so the Follow button and the header counts work without Pro. Both return early when Pro is active, and Pro then renders its own versions.

instagram_post_author ยท instagram_post_date 4.5.0 โ€” Author row and post time

Core Instagram templates fire both hooks for every post. Each hook passes 2 arguments, $feed, $template_meta. They are fired from template1.php (Classic Grid) and template2.php (Caption Card). They also run for the two templates that reuse those views: template6 (Author Bar, built on template1) and template5 (Author Card, built on template2).

Hook (wpsocialreviews/ prefixed)Default handlerRenders on
instagram_post_authorInstagramTemplateHandler::renderPostAuthortemplate5, template6 only: header avatar, username, and post time
instagram_post_dateInstagramTemplateHandler::renderPostDateevery template except template5 / template6

The two hooks split the work between templates, so a post's time is never printed twice. Both handlers use renderPostTime() ("3 days ago"). It prints nothing when post_settings.display_date is not 'true' or the post has no timestamp. The author row's avatar comes from $template_meta['_header_data']['avatar_url'].

Fired in: app/Views/public/feeds-templates/instagram/template1.php, template2.php

Usage:

php
add_action('wpsocialreviews/instagram_post_date', function ($feed, $template_meta) {
    if (empty($feed['permalink'])) {
        return;
    }
    echo '<a class="wpsr-ig-permalink" href="' . esc_url($feed['permalink']) . '">' . esc_html__('View', 'my-plugin') . '</a>';
}, 20, 2);
Instagram overlay-card seams and their exact arguments 4.4.0

Instagram templates 3 and 4 (Pro) fire the seams below. The argument counts are what the templates actually pass โ€” register with the matching count or your callback receives null.

Hook (wpsocialreviews/ prefixed)ArgsSignature
instagram_feed_template_item_wrapper_before1$template_meta
instagram_post_media4$feed, $template_meta, $index, $display_optimize_image
instagram_post_avatar2$feed, $template_meta
instagram_post_user_details2$feed, $template_meta
instagram_post_time2$feed, $template_meta
instagram_post_caption2$feed, $template_meta
instagram_post_statistics2$feed, $template_meta
instagram_icon0โ€”
instagram_shoppable_icon0โ€”

instagram_post_time is nested: it fires from inside Pro's renderPostUserDetails() handler, not from the template, so removing the instagram_post_user_details default also removes the time output.

instagram_icon fires twice per post in template 3 (the overlay bar and the hover state), and instagram_shoppable_icon fires only when the post carries shoppable options and the template's shoppable_settings.display_shoppable_icon is 'true'.

Fired in: Pro Views/public/feeds-templates/instagram/template3.php, template4.php, and Hooks/Handlers/InstagramTemplateHandlerPro.php

Usage:

php
add_action('wpsocialreviews/instagram_post_statistics', function ($feed, $template_meta) {
    if (empty($feed['id'])) {
        return;
    }
    echo '<span class="wpsr-ig-post-id">' . esc_html($feed['id']) . '</span>';
}, 20, 2);

Facebook โ€‹

Facebook element hooks

facebook_feed_template_item_wrapper_before, facebook_feed_template_content_wrapper_before, facebook_feed_author / _description / _media / _summary_card / _date / _statistics / _videos / _events / _album / _image / _like_button / _share_button / _photo_feed_image / _album_feed_info / _summary_card_image, load_more_button, facebook_feed_handle_album_photo.

TikTok โ€‹

TikTok element hooks (custom_feed_for_tiktok/ namespace)

custom_feed_for_tiktok/tiktok_feed_template_item_wrapper_before, tiktok_feed_media / _author / _author_name / _description / _icon / _statistics / _date / _bio_description, tiktok_header_statistics, tiktok_follow_button, load_more_tiktok_button.

Fired in: TikTok Views/public/feeds-templates/tiktok/*

Asset loading โ€‹

wpsocialreviews/load_template_assets ยท enqueue_product_context_styles
HookArgsPurpose
wpsocialreviews/load_template_assets$templateIdEnqueue assets for a template
wpsocialreviews/enqueue_product_context_styles$post_idEnqueue product-context styles

Source: app/Hooks/Handlers/ShortcodeHandler.php

See also the Rendering & Template HTML filters for replacing whole template blocks (rather than a single element).

WP Social Ninja Developer Documentation