Adding a template part as part of a shortcode

Question

I am using “Ultimate Member” plugin to allow users to register because I want some content to be restricted for not signed-in users. According to their documentation, there are a few shortcodes for that and I’m trying to sue one in a template like this:

<?php
    $out_content = get_template_part( 'templates/template-parts/loggedout', 'content' );
    do_shortcode("[um_loggedout] {$out_content} [/um_loggedout]");
?>

<?php
    $in_content = get_template_part( 'templates/template-parts/loggedout', 'content' );
    do_shortcode("[um_loggedin] {$in_content} [/um_loggedin]");
?>

Actually, both template parts are output this way, is this something that can be done?

0
, , Sergi 3 years 2019-10-30T10:52:14-05:00 0 Answers 107 views 0

Leave an answer

Browse
Browse