Post Terms As Class Name For Full Calendar Events

You are using get_single_term in a way that would require it to return a value… $term = get_single_term($post->ID, ‘course_locations’); … but you have written it in such a way that it echos a value. You should have… function get_single_term($post_id, $taxonomy) { $terms = wp_get_object_terms($post_id, $taxonomy); if(!is_wp_error($terms)) { return $terms[0]->name; } } I noticed a couple … Read more

prepopulate form from a hook within wordpress function.php file

You will need to declare the variable global before using it. function simple_form(){ global $firstname; $firstname=”Bob”; //Do something to populate the form field name <fname> with “Bob” } Your form should be able to do … global $firstname; echo $firstname; … to use the variable. However, I can’t help but think there is a better … Read more

post in a lightbox?

Your code cannot work. At first, your endwhile; and endif statements are inside the string. They will be printed and not executed. The correct formatted code should look like this $hotfoodpresent = get_posts( array(‘post_type’ => ‘st_notice’, ‘posts_per_page’ =>-1) ); if ( $hotfoodpresent ) echo ‘<a class=”lbp-inline-link-1 cboxElement” href=”#”></a> <div style=”display: none;”> <div id=”lbp-inline-href-1″ style=”padding:10px; background: … Read more

Get TOP x Tags from selected posts

With an array containing the post IDs its easy $post_ids = array( 167, 774, 787, 358 ); $tag_all = array(); foreach ( $post_ids as $post_id ) { $tags = wp_get_post_tags( $post_id, array() ); foreach ( $tags as $tag ) array_push( $tag_all, $tag->name ); } $result = array_count_values($tag_all); arsort( $result ); $result = array_slice( $result, 0, … Read more

Cannot control wp_nav_menu properly

As toscho pointed out the container argument should be left out or set to an empty string, and a menu should be created and assigned to the menu location (primary in this example).

Output posts with same name as tags?

You can use the get_page_by_title function as described by the codex here http://codex.wordpress.org/Function_Reference/get_page_by_title. Here is an example of getting the title of a post. By default, it’s looking for a post type of ‘page’: $current_post = get_page_by_title(“certain title”, OBJECT, “post”); echo “<a href=”” . $current_post->guid . “”>{$current_post->post_title}</a>”;