-2

I am trying to use php echo shortcode into Wordpress but I can't figure out how.

I want to use this shortcode:

php echo $pack['download_link']; 
2
  • <?php echo $pack['download_link']; ?> Commented Jul 10, 2015 at 22:58
  • possible duplicate of Insert PHP code In Wordpress Page and Post Commented Jul 13, 2015 at 5:41

2 Answers 2

2

To add a shortcode in worpress:

add_shortcode('tag','myfunction' ); this add the shortcode in wordpress

function myfunction {
//your code to run

}

In pages or post use [myfunction]:

in templates echo do_shortcode('[myfunction]');
Sign up to request clarification or add additional context in comments.

1 Comment

am using Ad Blocking Detector plugin here is my code i want to add into adbloc detector <?php if (!isset($pack['base_price']) || $pack['base_price'] == 0) { ?> <div class="text-center"> <?php echo $pack['download_link']; ?> </div>
0

Your question has already been answered in a previous post

In short, PHP code cannot run within a WP post without an associated plugin that will process the PHP shortcode.

3 Comments

i have installed adblocker detector on wordpress and i have create shortcode. Into the plugin settings allowed to ad content when adblocker user come and and when user comes without adblocker enabled. my point it's to get from my template the above shortcode (downlad link) and to add id into plugin editor. i can't figure out how to do this. i have installed also the plugin PHP Execution but nothing hapend
Does the plugin you've created specifically process PHP shortcodes? Sounds like the plugin functionality might not be working correctly in that case
first of all thanks for the responses. the plugin works perfect. into the plugin settings i can add content when adblocker user comes and the same when user doesn;t ave adblocker. this is into my template <?php echo $pack['download_link']; ?> the download link, this i want to hide with adblocker detector. when i have enabled adblocker,warning showing up, but i can't figure out how i can add this <?php echo $pack['download_link']; ?> correctly inside plugin editor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.