Menu Limitations

It shouldn;’t be so hard. All you have to do is to use wp_get_nav_menu_items filter. This will add 10 posts to submenu of item which title is equal to ”. function insert_my_posts_to_menu( $items, $menu, $args ) { $menu_order = count($items); $child_items = array(); foreach ( $items as &$item ) { if ( $item->title != ‘<SOME … Read more

WordPress Custom Fields (Checkboxes with multiple values)

Under the premise, that your database entries do get saved correctly and your problem occurs on retrieval only: If multiple boxes had been selected, the values should live in the database as serialized arrays. Fortunately, get_post_meta unserializes them for us, but they are still arrays. Hence, your conditional should be modified like so: $program_flags = … Read more

How to add date to navigation bar

It would be better to hook into the wp_nav_menu_{$menu_name}_items filter and add your date item in there: add_action( ‘init’, ‘wpse_106781_add_menu_items_hook’ ); function wpse_106781_add_menu_items_hook() { $theme_location = ‘thirdnav’; $theme_locations = get_nav_menu_locations(); /* Make sure the theme location is valid */ if ( ! isset( $theme_locations[ $theme_location ] ) ) return; /* Get the navigation menu assigned … Read more

How make a php script run only with wp-cron

WP_Cron isn’t a real cron scheduler. What it does is schedule events, mark when they should be run, and wait for page traffic. When the site is loaded, it checks to see if any of these tasks need to be run (i.e. the time they were scheduled for has passed) and runs them. So you … Read more

How do i calculate the total of values of custom fields in custom post types?

It’s a matter of keeping a running total. Because I’m not 100% clear on the question, below I am providing the changes / pseudo-code for what you want to do: <?php if ( is_user_logged_in() ): global $current_user; get_currentuserinfo(); // ADDED: Initialize the total variable to prevent warnings $grandtotal = 0; $author_query = array(‘posts_per_page’ => ‘-1′,’author’ … Read more

Image media upload metabox

In your JS you have twice the call to $(‘#dd_image’)and in your HTML you have no input named dd_image, but dd_image_one and dd_image_two… And also in your HTML you have twice id=”upload_image_button”and it’s bad :-). This way when you click on the first or the second button you do the same exact call and modify … Read more

Second level subcategory

Found the solution! 🙂 $taxonomies = array(CUSTOM_CAT_TYPE); foreach($taxonomies as $tax) { $args = array( ‘orderby’ => ‘name’, ‘show_count’ => 1, ‘pad_counts’ => 1, ‘hierarchical’ => 1, ‘hide_empty’ => 0, ‘taxonomy’ => $tax, ); wp_dropdown_categories( $args ); } Thanks for helping out!