Query stopped working
Query stopped working
Query stopped working
Turns out you can use this filter to alter the priority of the post_status links: https://github.com/WordPress/WordPress/blob/5c6b63d3a6874743542d6cede307c98ee370af23/wp-admin/includes/class-wp-list-table.php#L378 $views = apply_filters( “views_{$this->screen->id}”, $views ); If your custom post type is ‘inbound-email’ then the applied filter will look like this: add_filter( ‘views_edit-inbound-email’ , ‘function_to_filter_priority’ ); /** * rebuild priority of post status links * @param ARRAY $links * … Read more
Alright I figured it out! $args = array( ‘post_type’ => ‘vendors’, ‘order’ => ‘asc’, ‘orderby’ => ‘title’, ); $query = new WP_Query( $args ); if ( $query->have_posts() ) { echo ‘<ul>’; while ( $query->have_posts() ) { $query->the_post(); $category = get_the_category(); echo ‘<li class=”‘; echo $category[0]->category_nicename; echo ‘”>’ . get_the_title() . ‘</li>’; } echo ‘</ul>’; } … Read more
How to avoid hardcoded text in a custom page template?
You must call register_post_type on each page load, when you register a post type it doesn’t modify the database it updates variables which only exist for that page load. If you don’t do this WordPress is unaware of that post type. Much the same way that you register settings pages and styles on every page … Read more
Events with multiple event dates + permalink for each date
I do not in the world know why this works. Yet it does. For future reference… function remove_meta( $query ) { $query->set( ‘meta_query’, false ); } add_action( ‘pre_get_posts’, ‘remove_meta’ );
Use one template for different custom post types with the same markup
I found out how to solve this problem, and I hope I can help others in future. My goal was to create an url structure like this: landen/land/rondreizen, with the use of multiple custom post types. ‘landen’ and ‘rondreizen’ are both custom post types. The templating structure should wordpress-like, act like this archive/single/archive. After long … Read more
Blueprint Get all taxonomies. Loop through them. Get terms for current post. Code // Suppose you already have $post foreach ( get_object_taxonomies( $post ) as $taxonomy ) { foreach ( get_the_terms( $post->ID, $taxonomy ) as $term ) { // Do whatever you’d like with $term echo $term->name; } } References get_object_taxonomies get_the_terms