0

I create a custom payment for WordPress, is a simple code but I need to hide the code, I thought about creating a shortcode [custom_shorcode].

When I put the shortcode i need to display a custom html with php.

1
  • You will need to create a plug-in. Follow the example here Commented Apr 12, 2018 at 16:03

1 Answer 1

1

You can do this in the functions.php or a simple Plugin.
To create it in the functions.php of your child-theme, do it like this:

add_shortcode('your-shortcode', 'yourFunction');
function yourFunction(){
   //do your stuff
}

You can find the documentation here

Sign up to request clarification or add additional context in comments.

4 Comments

if i need convert this code to plugin only need create a folder in "/wp-content/plugins" but what is the name of the php document? index.php or myfunction.php? @tobias
yes, create a folder in /wp-content/plugins/ and name the file as you like (with.php)
I think it is necessary to add the plugin header where the plugin name data, creator, version, etc... A user left the necessary information in this post.
yes of course...see the documentation (developer.wordpress.org/plugins/the-basics)

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.