Adding a WordPress Widget to a settings page

You would call: add_meta_box( $widget_id, $widget_name, $callback, $screen->id, $location, $priority ); Where the screen ID is obtained via: $screen = get_current_screen(); Then display each location e.g. : do_meta_boxes( $screen->id, ‘column3′, ” ); Here’s the dashboard function that displays the dashboard: function wp_dashboard() { global $screen_layout_columns; $screen = get_current_screen(); $hide2 = $hide3 = $hide4 = ”; … Read more

Disable a plugin’s widget

You must use widgets_init hook with a high priority for example this will remove the default WP Widgets function unregister_default_wp_widgets() { unregister_widget(‘WP_Widget_Pages’); unregister_widget(‘WP_Widget_Calendar’); unregister_widget(‘WP_Widget_Archives’); unregister_widget(‘WP_Widget_Links’); unregister_widget(‘WP_Widget_Meta’); unregister_widget(‘WP_Widget_Search’); unregister_widget(‘WP_Widget_Text’); unregister_widget(‘WP_Widget_Categories’); unregister_widget(‘WP_Widget_Recent_Posts’); unregister_widget(‘WP_Widget_Recent_Comments’); unregister_widget(‘WP_Widget_RSS’); unregister_widget(‘WP_Widget_Tag_Cloud’); } add_action(‘widgets_init’, ‘unregister_default_wp_widgets’, 1);

How can I hard code my sidebar?

You can… 1. Enter your sidebar.php file and remove everything.. (better to just remove the code that calls the widigtized sidebar see examples) example 1 (it might look like this): <?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar(‘pages’) ) : else : ?><?php endif; ?> example 2 (it might also look like this): <?php wp_nav_menu( array( ‘theme_location’ … Read more

what is the best way to add things to a side bar

As you seem to understand from your tags, the user (who would need to have admin-level privileges) can add things to a sidebar via Widgets in Appearance > Widgets. For text and images, the default would be to drag the Text widget into the sidebar, then edit to add the text/image reference. To make this … Read more

Proper approach to moving complete site from one domain to another AND preserve widgets

There are some instances of serialized data in the database, notably in things like widget options, that become invalidated if you do a blind search-and-replace without accounting for different string lengths. You might try a tool like this one to do a search and replace that also handles serialized data: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()

WP doesn’t provide any helper methods for creating and processing forms in the front-end. To process your front-end form simply check for $_POST-ed data. I suggest you do this from within an action, and only if the widget is active. In your constructor – the someWidget() method (which you should rename to __construct, and call … Read more

Recent Posts widget missing current_menu_item class

The core Recent Posts Widget does not output any classes for the current post – probably because the Widget semantically is a list of posts, rather than a navigation menu, and therefore has no intended purpose to reflect current location. That said, with a bit of CSS/jQuery trickery, you could target the current post by … Read more