allow BOTH post slug and meta key value in permalink for custom post type

I found some good information here http://codex.wordpress.org/Plugin_API/Filter_Reference/request I added a filter to the request hook like so: add_filter( ‘request’, ‘alter_the_query’ ); The hook function goes like this: function alter_the_query( $request ) { $dummy_query = new WP_Query(); // the query isn’t run if we don’t pass any query vars $dummy_query->parse_query( $request ); // if requesting a … Read more

Default sort on admin columns with meta date hides draft posts with empty date value

I too was struggling with this (only I was sorting by a text-based meta value). Here’s what seems to have fixed the problem: $meta_query = array( ‘relation’ => ‘OR’, array( ‘key’ => ‘property_reference’, ‘value’ => false, ‘type’ => ‘BOOLEAN’, ), array( ‘key’ => ‘property_reference’, ‘compare’ => ‘NOT EXISTS’, ‘value’ => ”, //have to set value … Read more

Creating a navigation menu of all posts of a custom post type and their children posts?

Here is the general logic that can be used to fetch the child custom posts What I’ve assumed here is, You create a county post, then you create a area post and from parent metabox you select the desired county post and save the post id in post_parent function wpse_128630_cp( $post_type=”county”, $post_parent=””, $posts_per_page = -1 … Read more

different post-class when template is loaded via ajax

You have to use this format: FUNCTIONS.PHP function theme_name_scripts() { wp_enqueue_script( ‘script-name’, get_bloginfo(‘stylesheet_directory’) . ‘/js/min.js’, array(), ‘1.0.0’, true ); wp_localize_script( ‘script-name’, ‘ajax’, array( ‘url’ => admin_url( ‘admin-ajax.php’ ) ) ); } function ajax_callback() { get_event_list(); } add_action( ‘wp_enqueue_scripts’, ‘theme_name_scripts’ ); add_action(‘wp_ajax_ajax’, ‘ajax_callback’); add_action(‘wp_ajax_nopriv_ajax’, ‘ajax_callback’); AJAX: $.get( ajax.url, { ‘action’: ‘ajax’, ‘order’ : ‘DSC’, }, function( … Read more