Unable to sort wp_query by date/time with multiple meta_key s

Just an idea: you could save your time values in an array and then sort it with PHP. Example: $keys = array(‘opening_time’, ‘film_time’, ‘artist_talk_time’); $times = array(); $custom_field_keys = get_post_custom_keys(); foreach ($custom_field_keys as $custom_field_key) { if (in_array($custom_field_key, $keys) { $custom_field_value = get_post_meta($post->ID, $custom_field_key, true); if ($custom_field_value >= $thedate && $custom_field_value <= $future) { $counttest++; $times[$custom_field_key] … Read more

Comment submission & navigation redirects to default language

I’ve figured out the solution to my problems. Here’s what I did… Note: This is considering the posts, thus comments, are under the ‘Article‘ post-type, which thus create the permalink such as this: site.com/article/post-name/#comments. Adjustments should be made for other uses. To fix problem #1 & #3: if ( !is_admin() ) add_filter(‘get_comment_link’, ‘my_comment_post_redirect’); function my_comment_post_redirect($location){ … Read more

get_image_tag filter not working

Turned out my “answer” was that I didn’t really understand “get_image_tag.” It only runs when you first insert an image. I was thinking that it ran every time the edit interface was loaded. From researching and talking with others, it seems the only way to get the metabox data onto existing images is some kind … Read more

wp_redirect to file:// location results in blank page/cannot be displayed page

The above code didn’t work because of browser security. I’ve decided to go with this code: <?php global $post; the_post(); $location = get_post_meta($post->ID, ‘sc_stace_resource_location’, true); $count = (int) get_post_meta($post->ID, ‘sc_stace_view_count’, true); $count++; update_post_meta($post->ID, ‘sc_stace_view_count’, $count); ?> <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <html> <head> <title><?php the_title(); ?></title> <meta http-equiv=”REFRESH” content=”1;url=<?php echo $location; ?>”> </HEAD> … Read more

and custom post_types to custom menu

Try adding the action after the function like this: function mt_add_pages() { // Add theme options page to the addmin menu add_menu_page(__(‘Competition’,’comp’), __(‘Competition’,’comp’), ‘manage_options’, ‘mt-top-level-handle’, ‘test_func’, ”, 5 ); add_submenu_page(‘mt-top-level-handle’, __(‘Answers’,’comp-answers’), __(‘Answers’,’comp-answers’), ‘manage_options’, ‘sub-page’, ‘test_func2’); } add_action( ‘admin_menu’, ‘mt_add_pages’ );