Add dynamic content to a WordPress Page -
I want to know the most elegant / best practice method to do the following:
Suppose I have some PHP that gives a string (for example, today's weather). I want to be able to include the string within a WordPress page, but there is no page to use plug-in to allow PHP.
For example:
This is the content of the page which is editable through the WordPress pages. Today's weather is THE_WEATHER It is slightly editable, but as an editor I can not edit PHP which tells us what the weather is, the developer does it. What is the best practice method of doing this (without prioritizing the plug-in)?
Off-House, it seems as if you want to define a shortcode by which you invite that PHP function You can talk about it and put it in the page / post. It means very much that you are either writing a (very simple) plugin or you are inserting the shortcode definition in the functions.php file associated with a code (which is a simple child The subject may be what you are using). It probably depends whether you are likely to change the theme or not (if this is just a site) or you need to do the same thing or not different sites that can have different themes. If there are any issues, then you should write it as a plugin; Otherwise you can make it a part of your subject.
Consult codecs to learn how to define shortcodes.
Comments
Post a Comment