How to exclude certain widget from showing up on home/front page? [duplicate]

I’ve found the exact solution to my question here: https://wordpress.stackexchange.com/a/17687/92505 Here’s the exact code I used after some modification to make it work on my situation. Add the following code to functions.php where ‘sidebar-1’ is your sidebar ID. ‘recent-posts’ is the name of the widget your want yo hide. 12 is the length of the … Read more

Authors details such as social media links, emails etc → Is this Meta or something else?

Add user contact methods using the user_contactmethods filter in your theme’s functions.php or via a plugin: User contact method entries are stored in the wp_usermeta table. The URL field is special; it’s stored in the user_url field in the wp_users table. // Add user contact methods add_filter( ‘user_contactmethods’,’wpse_user_contactmethods’, 10, 1 ); function wpse_user_contactmethods( $contact_methods ) … Read more

Widget “Save” resetting jQuery hidden fields

You’re looking for jQuery.live(), or jQuery’s livequery plugin, depending on what you’re seeking to do. (The second is the proper one if you need to use onChange events.) As things stand, your jQuery hooks are not called when the save button is called, because the form’s tags are reloaded using ajax, and jQuery(document).ready() is, obviously, … Read more

WordPress “include TEMPLATEPATH” or?

Long answer short: the absolute-best answer, for template-part files in a subdirectory, is to use locate_template() I would recommend referencing the stylesheet path for template file includes, so that those template part files can be easily over-ridden by Child Themes. So, ideally, you should use get_stylesheet_directory_uri(). Some differences/explanation of all the functions listed by @kaiser: … Read more

Context aware widgets. My work in progress

Just like you would from a widget() method: function wse_widget_display_callback($instance) { $show_it = true; if(isset($instance[‘noHome’]) && $instance[‘noHome’] && is_home()) $show_it = false; if(isset($instance[‘noPages’]) && $instance[‘noPages’] && is_page()) $show_it = false; … if($show_it) return $instance; else return false; } I’ve posted here the functions I use to accomplish this, it might be helpful. The form hooks … Read more

Using tabs in admin widgets [closed]

The problem is that you’re not using unique IDs (#tabs, #tabs-1 …), because widgets have multiple instances (the same IDs are used by the instance form the “Available Widgets” area). So just prepend or append the widget instance ID to your identifiers to make them unique: … <div id=”tabs-<?php echo $this->id; ?>”> <ul> <li><a href=”#tabs-<?php … Read more

How do I create a drop down menu in a widget?

This is what I do: Static Options <select id=”<?php echo $this->get_field_id(‘posttype’); ?>” name=”<?php echo $this->get_field_name(‘posttype’); ?>” class=”widefat” style=”width:100%;”> <option <?php selected( $instance[‘posttype’], ‘Option 1’); ?> value=”Option 1″>Option 1</option> <option <?php selected( $instance[‘posttype’], ‘Option 2’); ?> value=”Option 2″>Option 2</option> <option <?php selected( $instance[‘posttype’], ‘Option 3’); ?> value=”Option 3″>Option 3</option> </select> Generate with options with PHP (example) … Read more

Including a custom post type in the Archives widget

The Archive widget is using wp_get_archives() to display the archive. If you want to target all the wp_get_archives() functions, you can use the getarchives_where filter to add your custom post type: add_filter( ‘getarchives_where’, ‘custom_getarchives_where’ ); function custom_getarchives_where( $where ){ $where = str_replace( “post_type=”post””, “post_type IN ( ‘post’, ‘videos’ )”, $where ); return $where; } If … Read more