How can I add a featured image to a page?

Eek! A 33% acceptance rate isn’t really going to do you any favours but lucky for you WordPress’ in-built post-thumbnail featured image functionality works for posts, custom post types and pages too. Add the following line into your theme functions.php file: add_theme_support( ‘post-thumbnails’, array( ‘post’, ‘page’ ) ); Then in your page.php file and I … Read more

Shared functionality in plugins and themes

Actions & Filters The imho best way is to use an action to bring plugin functions into themes. Example #1 Here’s a little plugin to test this. <?php /** Plugin Name: (#68117) Print Hello! */ function wpse68117_print_hello() { echo “Hello World!”; } add_action( ‘wpse68117_say’, ‘wpse68117_print_hello’ ); Inside the theme: <?php /** Template Name: Test »Print … Read more

Security and .htaccess

UPDATE: When I first posted my answer I missed the crux of the question; my answer was about .htaccess security in general and is now listed below the double line (look down if it interests you.) Unfortunately I don’t have specific experience with securing /wp-admin/ using .htaccess so I’ll simply list the two resources I … Read more

Combine multiple plugins into one?

Go through each plugin file and remove the plugin header. Create a loader.php file. Something like this: <?php /* Plugin Name: Combined Plugin Description: Contains plugin a, plugin b and plugin c */ include dirname(__FILE__) . ‘/plugin-a.php’; include dirname(__FILE__) . ‘/plugin-b.php’; include dirname(__FILE__) . ‘/plugin-c.php’;

How can I call a function from one plugin within another plugin?

Maybe you should try calling the functions of your plugin using the plugins_loaded action. Plugin A class PluginA { public function func_a() { // do stuff } } Plugin B class PluginB { function functB() { if (class_exists(‘PluginA’)) { //do stuff that depends of PluginA } } } add_action(‘plugins_loaded’, ‘call_plugin_a_using_plugin_b’); function call_plugin_a_using_plugin_b() { PluginB::functB(); } … Read more

How to roll back a WordPress plugin update?

Unless the plugin has made significant database changes, you could follow these steps to downgrade it: Download and extract the old version from the plugin repository Disable the plugin Log on to your server with FTP or SSH Upload the old plugin directory to wp-content/plugins/. (You would want to overwrite the newer version.) Reactivate the … Read more

How do I cleanly override a plugin’s CSS with a child theme?

If the plugins are correctly adding their styles via wp_enqueue_style, you simply need to dequeue them: function wpa_dequeue_style() { wp_dequeue_style( ‘plugin-style-handle’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpa_dequeue_style’, 100 ); Whether or not this works depends on how and where the plugins are adding their styles, so there’s no absolute answer without knowing specific methods the plugins … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)