How to run the shortcode inside PHP?
-
Hi
I’m trying to run the [catlist] shortcode inside a php file.
The problem is I can obtain the category name only through a php function:
<?php echo $slug=sanitize_title($current_user->membership_level->name);?>
and I need to insert that name inside the [catlist=”name”] shortcode.My attempts that failed:
1. I have made a snippet out of the php so it looked like:[catlist ="[php snippet = 1]"]
2.<?php echo do_shortcode('[catlist name=sanitize_title($current_user->membership_level->name);]'); ?>
I have tested some other coed but to no avail. I have run out of ideas. Could you please help me to get the result?
Regards
Tom
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to run the shortcode inside PHP?’ is closed to new replies.