Add a widget to a static front page

In order to add widgets to any page you need to have a dynamic sidebar configured. Whether or not you have a dynamic sidebar that is visible from your home page depends on the theme. If you don’t, you can initialize a new sidebar by using the register_sidebar() function in your functions.php file (http://codex.wordpress.org/Function_Reference/register_sidebar) And … Read more

Text Widget to Show database fields based on post

I can’t find a plugin that does this, but here’s an alternative: You can use code like this to get the post’s metadata (custom field) values in the widget sidebar.php: <?php global $post; ?> <?php $sidebar = get_post_meta($post->ID, ‘sidebarval’, $single = true); ?> <?php if($sidebar != ”) { ?> <?php $myrows = $wpdb->get_results( “SELECT id, … Read more

Removing widget without using unregister_widget

Check the following answer, adapt the code and it will do what you want. https://wordpress.stackexchange.com/a/3005/12615 Use Firebug for Firefox, or Chrome/Safari inspector to discover the widget ID. Note the use of CSS3 attribute selector, that allows targeting an element using a partial ID or Class. For example, this will hide the Calendar widget: div.widget[id*=_calendar-] { … Read more

Creating a widget that displays the content of a page

If you hard-coded your custom query directly in the page template, then you’re going to need to duplicate that custom query in a custom Widget. On the other hand, if you’ve abstracted the custom query (either into a template-part file, or better yet, a custom function), then you can simply include the template-part file or … Read more

Any available action to add content before and after sidebar?

You can create your own actions using do_action, like this: <?php do_action(‘before_sidebar’); // you can name it whatever you want ?> <?php if ( is_active_sidebar(‘main-sidebar’) ) : ?> <ul> <?php dynamic_sidebar(‘main-sidebar’); ?> </ul> <?php endif; ?> <?php do_action(‘after_sidebar’); ?> and use add_action() normally: add_action(‘before_sidebar’, ‘before_sidebar_function’); add_action(‘after_sidebar’, ‘after_sidebar_function’); UPDATE: depending on the codex you can use … Read more

Any advice on customising this twitter feed?

It’s part of the Webzine theme – if you take a look at the source, near the bottom, there’s a rather hefty chunk of JS that queries Twitter & renders the tweets. Now whether that code is sat there waiting for you in footer.php, or called in from somewhere else, I don’t know – if … Read more

Issue with checked() echoing on to page

By default, checked echoes. If you set the (currently empty) third parameter to false, it should work as expected. Change the line to: $$sku = isset( $instance[$sku] ) ? checked( (bool) $instance[$sku], true, false ) : false; More info: http://codex.wordpress.org/Function_Reference/checked

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