Has anyone encountered this problem before? Directly calling the shortcode from WordPress and calling the shortcode via functions.php yields different results.
Image 1 has decent design since it was invoked directly from WordPress UI while Image 2 somehow messed up the design because it was invoked from php (functions.php).
Additional info:
- Current theme is DIVI
- Shortcode/Plugin used is TableMaster
To add further information, I have this line of shortcode in WordPress (as seen on image 2).
[get_blogs_sc]
And on my functions.php, I have this function,
function GetActiveBlogs($i)
{
$actual_link = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if (preg_match('/sites/',$actual_link))
{
$user_id = get_current_user_id();
if ($user_id > 0)
{
echo do_shortcode('[tablemaster buttons="true" datatables="true" class="black-header-gray-alternate-rows" sql="some select where user_id = '.user_id.'"]', true);
}
}
}
add_shortcode('get_blogs_sc', 'GetActiveBlogs');
But when I use the shortcode directly from WordPress:
[tablemaster buttons="true" datatables="true" class="black-header-gray-alternate-rows" sql="some select where user_id = 14]
the display on my page looks good (as seen on image 1)
My objective on putting the shortcode in php-layer is for me to be able to capture the logged-in user from WordPress.
Thanks.
