Skip to content
Advertisement

How do I add page to wordpress website and giving it a specific short code via custom plugin

I have made an action that allows a page to be made if the switch in the setting is checked. After it is confirmed it’s checked it does create the page, but without the template added. How do I get my template to work?

JavaScript

This is what my template page looks like in the plugin.

JavaScript

Advertisement

Answer

In my case, I have figured out a solution for the simple problem. If I just need to add a shortcode I can add it to ‘post_content’. I would still like to know how to add template. But you can use a file to import the entire layout if you’d like still. But it cannot be used with visual composers.

See example below…

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement