How to enable likes on pages?

By default, the likes are only available for posts and activated via the theme panel.

http://d.pr/i/z28T

You can add this custom php code within your child theme functions.php to enable it for pages as well.

function xt_child_page_likes($content) {

    global $XT_Likes;
    
    $post_type = get_post_type();

    $xt_likes_enabled = (bool)xt_option('likes_enabled');
    
    if ( $post_type == 'page' && is_singular($post_type) && $xt_likes_enabled ) {
        $content .= '<div class="row in-container">';
        $content .= '<div class="column small-12">';
        $content .= $XT_Likes->votes();
        $content .= '</div>';
        $content .= '</div>';
    }
    return $content;    
}
add_filter('the_content', 'xt_child_page_likes', 10);</p>
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us