WordPress Hide Widget If $_Session Is Active?

The easiest way to do this is via dynamic_sidebar() <?php if ($a == $b) // Your $_SESSION stuff dynamic_sidebar( ‘Right Sidebar’ ); ?> Any widgets contained in the “Right Sidebar” will now be loaded based on your condition. You should use this with register_sidebar() http://codex.wordpress.org/Function_Reference/dynamic_sidebar

Add New Footer Widget Area with Limited Options?

Widget areas are the wrong tools for what you need. They are built to offer a choice. Breaking that would be very difficult … and hard to understand for the user. Alternative: Use a custom setting, for example in wp-admin/options-general.php where the tagline and the site title is. There is even a hook for such … Read more

Registering multiple copies of a widget

You really need to be using the Widget API. Here is a widget shell to get you started. class WPSE_Widget_Shell extends WP_Widget { function __construct() { $opts = array( ‘description’ => ‘Brief description; shows on the backend’ ); parent::WP_Widget( ‘widget-id’, ‘Widget Name’, // shows on the backend $opts ); } function form($instance) { echo ‘backend … Read more

Multiple widgets in wordpress

Try to generate your div to have a value that makes clear what kind of content it loads, for example: <div class=”social-count” role=”facebook”></div> <div class=”social-count” role=”twitter”></div> Then, via jQuery, change them by that value, for example: $(‘.social-count[role=”facebook”]’).html(count); $(‘.social-count[role=”twitter”]’).html(count);

twenty twelve theme widgets not working

Your most likely having an issue with the plugins. These types of problems are extremely hard to diagnose. I had a similar problem with the WordPress theme Arjuna-X where it was loading it’s own modified JQuery library that was only breaking the switching of “Visual” and “HTML” in the post editor. Took me days to … Read more

WordPress function breaks widget’s markup?

wp_list_pages does not wrap it’s output in a ul or ol tag. That’s up to you. In other words, if you just call wp_list_pages, it’s going to spit out a bunch of li tags, which your browser assumes is wrong and “corrects” the html as it sees fit. Try this: function widget( $args, $instance ) … Read more

Putting a wordpress custom post into a widget

You will need a “form” and an “update” method for your widget class. function form($instance) { $instance = wp_parse_args( (array) $instance, array (‘show’) ); $show = (!empty($instance[‘show’])) ? $instance[‘show’] : ”; echo ‘<input type=”text” name=”‘.$this->get_field_name(‘show’).'” value=”‘.esc_attr($show).'” />’; } function update($new_instance, $old_instance) { $instance = $old_instance; $instance[‘show’] = ($new_instance[‘show’]) ? $new_instance[‘show’] : 1; return $instance; } … Read more