Can’t output the number 0 in widget
If you add an exact comparison to the test it should work: $t1Inning1 = isset( $instance[‘t1Inning1’] ) && $instance[‘t1Inning1’] !== ” ? $instance[‘t1Inning1’] : ‘-‘;
If you add an exact comparison to the test it should work: $t1Inning1 = isset( $instance[‘t1Inning1’] ) && $instance[‘t1Inning1’] !== ” ? $instance[‘t1Inning1’] : ‘-‘;
This question has been answered many times already on this site. There’s 2 simple steps: One: Add to functions file register_sidebar( array( ‘name’ => __( ‘Your Sidebar’ ), ‘id’ => ‘wpsites-sidebar’, ‘description’ => __( ‘Your Sidebar Description.’ ), ‘before_title’ => ‘<h1>’, ‘after_title’ => ‘</h1>’, ) ); Two: Add where you want to output sidebar <?php … Read more
Your widget is an extension of the WP_Widget class, which defines the widget function. This is where your code should go. class WPDev_156470_Widget extends WP_Widget { // other stuff public function widget( $args, $instance ) { if ( ! is_user_logged_in() ) { echo ”; return; } // logged-in-user stuff } // other stuff } // … Read more
In your style.css add this: .widget { margin-bottom: 20px; } That should give all your widgets 20 pixels of spacing but only works when the widgets are stacked on top of eachother. If you have multiple sidebars and only want this to happen on a single sidebar, add a more-specific selector i.e. .my-special-sidebar .widget { … Read more
Remove: ‘no_found_rows’ => true, from your WP_Query call inside the widget code. Additionally I would suggest to make this change : ‘base’ => add_query_arg( ‘latest_page’, ‘%#%’ ), in your paginate_links call, because add_query_arg() will handle if ? or & is used. This should make the pagination work in your widget. Note: I’m almost, haven’t tested … Read more
I think I see the problem now. None of your links have a closing anchor tag which is cascading down until it hits the end at which point you close it on phone number: Your Code: echo ‘<a href=”‘.$facebook.'” target=”_blank”><img src=”‘. get_stylesheet_directory_uri() .’/images/fb.png” height=”24″ width=”24″ alt=”facebook”>’; What it should probably look like: echo ‘<a href=”‘.$facebook.'” … Read more
function wpsites_remove_default_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’); unregister_widget(‘WP_Nav_Menu_Widget’); } add_action(‘widgets_init’, ‘wpsites_remove_default_widgets’, 11); Add this in your functions file or a site specific plugin. Uses unregister widget
I have deleted the lines of code I mentioned above and only left the remaining code in sidebar.php. The problem was they were hard coded so they appear if visibility is set to hidden to the sidebar widgets.
Filter “widget_comments_args” won’t work
I assume you would like to do this through the WordPress admin and not edit your sidebar.php so here is a possible solution. First, find out what the timestamp of August 22 was at http://www.epochconverter.com. Based on GMT time I got “1408665600” Install the Widget Logic Plugin: https://wordpress.org/plugins/widget-logic/ Add a widget to your left sidebar. … Read more