0

How can i develop a shortcode, which checks, if the current page is the page of the user, does something if it is and something else, if it is not?

0

I don't know how you are assigning a page to the user, however you can develop a short-code as following:

<?php

   function myFunction()
   {
       if({condition check})
       {
         /*do ur stuff */
       }
       else
       {
         /*do ur stuff */
       }
   }

   add_shortcode('your_shortocde_string', 'myFunction');

?>

Define the function in functions.php You can call by using shortcode [your_shortcode_string]

I hope this will be helpful. Happy Coding :)

  • Thats really helpful, thanks! :) About the user page: I thought about checking the page slug, if it contains the nicename of the user. – Dominik Baumgartner Apr 30 '17 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.