Featured Image metabox lost
Have you got the following in your functions.php file – it might solve the problem: add_theme_support( ‘post-thumbnails’ );
Have you got the following in your functions.php file – it might solve the problem: add_theme_support( ‘post-thumbnails’ );
I solved my problem by automatically adding the tag ‘light’ to all my projects. And then query all the post and projects with the light tag like this: Query post by taxonomy tag ‘light’: $args = array( ‘post_type’ => array( ‘projects’ , ‘post’ ), ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘post_tag’, ‘field’ … Read more
Turns out there was a function hooking the filter list_terms_exclusions, and the return was inside a logically faulty conditional. I fixed it and now the term query exclusion works as intended.
For every taxonomy you have to choose a unique name, which is used in the database. so so your new e.g. players_region. <?php add_action( ‘init’, ‘build_taxonomies’ ); function build_taxonomies() { register_taxonomy( ‘players_team’, // Unique name. ‘player’, // Post type. array( ‘hierarchical’ => true, ‘label’ => ‘Players Team’, ‘query_var’ => true, ‘rewrite’ => true, ) ); … Read more
Try to use orderby name and order asc and desc to achieve category order $categories = get_categories( array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’ ) ); foreach( $categories as $category ) { echo $category_names = $category[1]->name; } // echo wp_json_encode($category_names);
You shouldn’t need to do any of that. When you set up a category in the backend of a WordPress website, the archive is normally created/taken care of for you. So if you create a category called ‘Massive Dogs’ and you got to “/massive-dogs’ after you have created a post in that category (and the … Read more
Here’s the code. You can change $post_type and $custom_fields according to your needs. function extend_admin_search( $query ) { // Extend search for document post type $post_type=”document”; // Custom fields to search for $custom_fields = array( “_file_name”, ); if( ! is_admin() ) return; if ( $query->query[‘post_type’] != $post_type ) return; $search_term = $query->query_vars[‘s’]; // Set to … Read more
Finally figured it out! global $wp_query; echo $wp_query->query_vars[‘grant-type’]
WordPress can handle this automatically by creating a page called archive-CustomPostTypePage.php through register_post_type() function. eg. archive-documents.php You need to register your post type in the functions and the name has to be the same as the php file name above eg: register_post_type(‘documents’, array( // YOUR ARRAY HERE ));
wp_get_post_terms did the trick