I need some direction on how to have a sidebar based on meta rather than page

Create a sidebar $type . ‘_sidebar’ Register the sidebar $type . ‘_sidebar’ (e.g dog_sidebar) Pass the type as GET argument to the widget.php (create some menu entries or something else where you link to e.g. wp-admin/widgets.php?sidebar_type=dog_sidebar) Filter out every sidebar that should not be displayed. You can use this function: global $wp_registered_sidebars; $type =filter_input( INPUT_GET, … Read more

nowplaying.include.php Will Not Display Results

Your script is at /wp-content/themes/responsive-child-theme/nowplaying-example.php but you are including /nowplaying-example.php. That is not going to work. You need to provide the complete path for that include: include(get_stylesheet_directory().’/nowplaying-example.php’); Assuming I have read that right, and assuming that the files are actually there. Your other code– the widget code– contains curly quotes. Don’t use those. Use ordinary, … Read more

Ajaxing function in widget class

If this is in a widget class, you need… add_action(‘wp_ajax_my_func’, array($this,’my_func’)); … not just… add_action(‘wp_ajax_my_func’, ‘my_func’); However, I suspect there to be more problems than just that due to the context you are using this in. But without more code, that is all I’ve got. Based on new information in the question… Both your function … Read more

Add ‘Right Now’ widget to custom dashboard

I’ve got to know it in Make WordPress UI. The plugin Dashboard uses a very interesting technique: add_action( ‘load-index.php’, array( $this , ‘override_dashboard’ ) ); public function override_dashboard() { if( !isset( $_GET[‘page’] || ‘custom-dash’ != $_GET[‘page’] ) return; if ( get_current_screen()->in_admin( ‘site’ ) ) { require dirname( __FILE__ ) . ‘/dashboard-override.php’; exit; } } And … Read more

Dashboard Widget Form

That if(‘POST’…) just alone -in the middle of the plugin code- doesn’t seem right. You can hook into load-$pagenow and process the form submission there: add_action( ‘load-index.php’, ‘check_posted_data’ ); function check_posted_data() { if( ‘POST’ == $_SERVER[‘REQUEST_METHOD’] && !empty( $_POST[‘my_prefix_message’] ) ) { wp_die( “I’m here! {$_POST[‘my_prefix_message’]}” ); } } Please note that you’re missing security … Read more

Insert custom content before widget title/after widget opening tag

You can use the dynamic_sidebar_params filter: add_filter( ‘dynamic_sidebar_params’, function( $params ) { // target a sidebar id: if( isset( $params[0][‘id’] ) && ‘sidebar-1’ === $params[0][‘id’] { // target a widget name: if( isset( $params[0][‘widget_name’] ) && ‘Text’ === $params[0][‘widget_name’] ) { // target a widget id: if( isset( $params[0][‘widget_id’] ) && ‘text-8’ === $params[0][‘widget_id’] ) … Read more

Tips for targeting widget dragable for WP Pointer on widgets.php page

Since the Feature Me widget in the Available Widgets list, is wrapped into something like this: <div id=”widget-5_feature_me-__i__”>…</div> I then wonder if the following would work (untested): ‘target’ => “div[id$=’_feature_me-__i__’]”, to target all div elements with id’s that end with _feature_me-__i__. I think there should only be a single match, at most, if this works.

Using jQuery in widget development

You can hook into the DOMNodeInserted event to find out when your widget has been added to the side bar. jQuery(document).on(‘DOMNodeInserted’, ‘.widget-top’, function () { alert(jQuery(‘.widget-title’, this).text()); }); The code above will alert to any newly added widget. Once you’re hooked into the newly created widget, you can traverse it to find your specific class … Read more

Custom Tag Cloud widget missing tags

What tags/terms/taxons do you get? The the_tags( $before = null, $sep = ‘, ‘, $after=”” ) function is a wrapper for get_the_tag_list( $before=””, $sep = ”, $after=””, $id = 0 ). This function applies the filter the_tags on the get_the_term_list( 0, ‘post_tag’, $before=””, $sep = ”, $after=”” ) (0 is the $id and $post_tag the … Read more