How to call a plugin function in footer.php

After installing the plugin and adding images to a new gallery, paste this code into your footer.php file where you want the gallery to display <?php echo do_shortcode(‘[easy-media med=”231,233″]’); ?> Simply change the gallery i.d’s to your own as the ones in the code above are examples. No Need To Use A Plugin I also … Read more

Plugin throws up 404 on front-end when when enqueuing style with filetime

You’re getting the 404 error because you didn’t provide the correct URL address of your CSS file. And that’s because of the first plugin_dir_path() below which outputs a filesystem directory path (e.g. /home/user/var/www/wordpress/wp-content/plugins/my-plugin/): wp_enqueue_style( ‘myplugin-style’, plugin_dir_path( __FILE__ ) . ‘/css/style.css’, array(), filemtime( plugin_dir_path( __FILE__ ) . ‘/css/style.css’ ) ); So you should instead use plugin_dir_url() … Read more

register child class in another plugin

I question the wisdom of extending a class from another plugin. You have no idea what will happen next time that other plugin gets updated. However, generally speaking you can control when in a hook “queue” a function runs by passing a third parameter– a priority. So pass a priority high enough and your function … Read more

bulk post_content update

This is what I mean: <?php $tochange = get_posts(‘numberposts=-1&post_type=any&category_name=category-name-you-want-to-change’); foreach($tochange as $post){ setup_postdata($post); $contentchange=””; /*here you do the magic, string replace or whathever you want to do*/ $tochange = array(); $tochange[‘ID’] = $post->ID; $tochange[‘post_content’] = $contentchange; $out = wp_update_post($tochange); unset($tochange); } wp_reset_query(); ?>

How do I get Version of all active plugins programmatically?

Problem Analysis To get information about installed plugins, which provides plugin’s version, we’ll use get_plugins() function. Keep in mind, that this function is available in back end only, so our code must reside there. Data, returned from this function, does not tell us, which plugins are active. To filter out active plugins, we’ll use get_option(‘active_plugins’) … Read more

plugin get value from admin panel page

If you want to add an settings page, (or add options to and existing settings page) please use the settings api: register_setting add_settings_section 1. Register your settings and add a section: add_action(‘admin_init’, ‘plugin_admin_init’); function plugin_admin_init(){ register_setting( ‘wpse51578_options_group’, ‘my_option_field_name’, ‘wpse51578_validation_callback’ ); add_settings_section(‘wpse51578_main_id’, ‘My Main Settings’, ‘wpse51578_main_settings_cb’, ‘wpse51578_option_page’); } The ‘my_option_field_name’ int the register_settings is the name … Read more