How to use Plugin in Wordpress Theme

Use the plugin in Wordpress Theme

If you buy a WordPress theme, you get it in a zip file. bedrock Our FavePersonal Theme includes the great social plugin of MailChimp and an optional on/off switch. The most important thing is that we made it so that the social plugin can still be separately deployed and upgraded. The most important thing to keep in mind when embedding a plugin in a design is a circumstance where the same PHP source twice gets used.

Or in other words, don't just() insert the plugin into your design. When someone has already enabled this plugin on their website, you have "loaded" the problem twice (and your website would crash). In order to prevent this from happening, it makes sense to look at the WordPress loading procedure (in Windows XP preferences. phi, related to Windows XP 3.4.1).

WordPress's first thing to do is loading into its kernel functionality: Download s Sie die meisten WordPress. require( ABSPATH `WPINC. WPINC.'/class-wp-walker. php' ) ; require( ABSPATH.'/WPINC.' /class-wp-ajax-response. php') ; require( ABSPATH.'WPINC.'/formatting.php')} ; require( ABSPATH.'/capabilities. php') ; require( ABSPATH and ' /cabilites. php' ) ; require( requires ( OJSPATH.

THE WPINC. query. php'); require( ABSPATH , WPINC .'/theme. php'); then MU ( Must Use ) plug-in loads; these are those that are moved to the wp-content/mu-plugins folder and cannot be handled from the plug-in's mainland.

Download the features for the current theme, both the superordinate theme and the subordinate theme, if any. Features.

ok, now we have all the parts of the whole thing that we need to know in order to correctly parse a plugin from a theme. As the topic is loaded last, we can use this to our benefit.

When the plugin is seperately as a plugin (and not as part of the theme) we can see that it is on. When it' already activated, we don't want to reload it. Execute this command on'after_theme_setup' if you have already plug-ins loading. add_action('after_setup_theme','my_load_plugin'); // This command is loading the plugin.

In our FavePersonal theme we have added an extra checkmark in the if directive to see if the social plugin activation preference is enabled. It allows us to prevent the plugin from downloading if the website user has chosen to deactivate this feature. Here you have it - quite simply, the plugin is only downloaded by the theme if it has not been enabled as a separate plugin, and the plugin is correctly placed before init or the wp_loaded (where a plugin usually does setup work).

Personality, social.

Auch interessant

Mehr zum Thema