Get widget settings function?
Get widget settings function?
Get widget settings function?
There’s at least 3 options: You could take the code for the native recent posts widget and modify it in your child theme to work with your custom taxonomy. You could create a new WP_Query using the tax parameters. Or you could use a filter widget_posts_args to modify the default output of the native recent … Read more
Sidebars are output in registration order, which is implicitly captured by how they are added to a $wp_registered_sidebars global. This can easily be manipulated, for example following code will move first sidebar to the start: add_action( ‘register_sidebar’, function ( $sidebar ) { global $wp_registered_sidebars; if ( ‘first’ === $sidebar[‘id’] ) { $sidebar = $wp_registered_sidebars[‘first’]; unset( … Read more
The WordPress codex mentions you should call the Widget Class name. Could it be that openingTimesWidget is a function instead of a Class? Following the WP Class naming convention your class would be written like this Opening_Times_Widget. https://codex.wordpress.org/Widgets_API Another possible reason that the widget is not displaying could have to do with the way your … Read more
Uninitialized string offset: 0 This error is showing because there is an empty value. Try checking if the value is !empty() (not empty) first. Here’s the source code you provide in your question with my update. function cf_form_message() { global $errors; if ( is_wp_error( $errors ) && empty( $errors -> errors ) ) { ?> … Read more
In your functions.php file try register sidebar without putting in function like this register_sidebar(array( //try not to enclose this in function ‘id’ => ‘primary’, ‘name’ => ‘Primary Sidebar’, ‘description’ => ‘A short description of the sidebar.’, ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h3 class=”widget-title”>’, ‘after_title’ => ‘</h3>’, )); And make … Read more
If you want to add the widget area as part of the output var you need to use the ob functions because it is echoed and not returned. Like this: $output .= ‘<div id=”header-image-widget-area”>’; ob_start(); dynamic_sidebar( ‘header_image_widget’ ); $output .= ob_get_clean(); $output .='</div>’;
It looks like the suggestion by @DaveRomsey will solve the problem. Another simple idea is from a plugin by Stephen Cronin, (I’m not related to that plugin in any way.) that uses the widget_title filter: add_filter( ‘widget_title’, function( $title ) { return ‘!’ === mb_substr ( $title, 0, 1 ) ? ” : $title; } … Read more
I don’t think there’s wp_nav_menu action. Perhaps you want the wp_nav_menu filter (doc)? function custom_novice_menu($args) { if( ‘primary’ == $args[‘theme_location’] ) // only apply to the right menu { $args[‘container’] = ‘div’; } return $args; } add_filter(‘wp_nav_menu’, ‘custom_novice_menu’);
There are several ways you can achieve this: A. Use CSS to hide and show widgets based on which page you are on. This is fine as a workaround, but it isn’t really solving your problem, especially if you have lots of pages/widgets. B. Call a different widget area in your template file with conditional … Read more