Give a function a unique ID

Just… call the function again – you only need to include it once! include ‘./path/to/lib.php’; echo_tweet_js(); // a little tweeting here … echo_tweet_js(); // and a little tweeting over here!

Single Widget Multi Sidebar

I figured it out after looking at wp_option tables for my widget and the sidebars_widget option I figured out that my widget name has to be none white space separated, in my case it should be anzima_posts_widgets, also I have to include the base-id in the control_ops parameter as the first index. Another issue I … Read more

How do I stop out of stock items from appearing on my WooCommerce site when using the Layered Nav widget [closed]

// Out of stock for general woocommerce – might help someone function product_in_stock($post, $product) { if (!$product->is_in_stock()) { $STOCK = TRUE; return $STOCK; } else { return false; } } function check_if_out_of_stock(){ global $post,$product; $stock = product_in_stock($post,$product); $output=”<div class=””; $output .= $stock?”instock”:”outofstock”; $output .= ‘”>’; echo $output; } add_action( ‘woocommerce_before_shop_loop_item’, ‘check_if_out_of_stock’); function close_out_of_stock(){ echo “</div>”; … Read more

Author Link in Recent Posts Widget

I think the rather simplistic approach would be: copy the whole WP_Widget_Categories from wp-includes/default-widgets.php, and paste it to your functions.php. In there, you could modify the output by customizing this part of the class: class WP_Widget_Recent_Posts extends WP_Widget { … <?php echo $before_widget; ?> <?php if ( $title ) echo $before_title . $title . $after_title; … Read more