Custom widget using get_categories select menu dropdown

Ok I found a solution thanks to this: Using wp_dropdown_categories in widget options Here is the code I used instead: function form( $instance ) { /* Default Widget Settings */ $defaults = array( ‘title’ => ‘Highlight Category’ ); $instance = wp_parse_args( (array) $instance, $defaults ); ?> <!– Widget Title –> <p> <label for=”<?php echo $this->get_field_id( … Read more

Completely disabling widgets

One option would be to simply flush the widget code out of the sidebar.php file, as well as the header/footer/post pages if they are using widgets. However, take a peek at this code snippet (courtesy of this site), which you can add to your functions.php file and will disable the widgets. I think this would … Read more

Why use widgets?

I battled with this very same question. I’m presently developing my own ability to develop WordPress sites. My employer is launching numerous websites on the engine, and is moving me from general PHP work to focused WordPress development. The thing is, these sites will all be managed by other people, and not myself. Using widgets … Read more

How to add css classes to widgets using functions.php?

Alright, so I managed to pull it off thanks to @toscho who provided me with this link: Add class to before_widget for all widgets with a dropdown and a counter I kind of worked up through it. All I wanted to do was add one class “col-sm-4” from Bootstrap to the search widget. is_admin() || … Read more

Ask user permission when activating a plugin

Try the following code: add_action( ‘admin_head’, ‘ask_for_activation’ ); function ask_for_activation() { ?> <script type=”text/javascript”> jQuery(function($){ $(‘span.activate a’).click(function(e){ var c = confirm(‘Are you sure wnat to activate?’) if(!c) { e.preventDefault(); return false; } return true; }); }); </script> <?php } You can add those codes in your functions.php in the theme, if you think your theme … Read more

Create More Widget Holders Like Active Widgets and Inactive Widgets

Probably isn’t considered “best practices” but it gets the job done. Here’s what I did: In my wp-admin/widgets.php, After these lines, // register the inactive_widgets area as sidebar register_sidebar(array( ‘name’ => __(‘Inactive Widgets’), ‘id’ => ‘wp_inactive_widgets’, ‘class’ => ‘inactive-sidebar’, ‘description’ => __( ‘Drag widgets here to remove them from the sidebar but keep their settings.’ … Read more

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