Radom post image/link based on custom taxonomy

<?php query_posts( ‘cat=36&post_type=athletes&showposts=1&orderby=rand’); ?> changed to : <?php $args = array( ‘numberposts’ => 36,’category’ => ‘1’,’post_type’ => ‘athletes’, ‘orderby’ => ‘rand’); $lastposts = get_posts( $args ); foreach($lastposts as $post) : setup_postdata($post); ?> <h2><a href=”https://wordpress.stackexchange.com/questions/56381/<?php the_permalink(); ?>”><?php the_title(); ?></a></h2> <?php endforeach; ?>

Strange widget behavior

I am not seeing you registering the widget in this code. For inside of a theme: register_widget(‘WP_Widget_Mood’); For inside of a plugin: add_action( ‘widgets_init’, create_function(”, ‘return register_widget(“WP_Widget_Mood”);’) );

PHP Widget and do_shortcode

The problem was the double quotes which are needed in normal shortcode usage in posts and pages for some reason when using do_shortcode the double quotes in the attributes where breaking the function. Working code below <div> <?php $lat = get_field(‘woo_maps_lat’); $long = get_field(‘woo_maps_long’); echo do_shortcode(‘[forecast location=’ . $lat .’,’.$long. ‘]’); ?> </div>

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