What is better: Custom Fields vs Custom Taxonomies with Terms for perfomance, scalability and better user experience

Finally after the holidays I returned back to this question. I chose to use Custom Taxonomies instead of Custom Fields. Here is why: It’s faster to make different queries (even if I will not have many posts) Most of these attributes are reusable (shared) They may be changed/modified easily in the future I’m not going … Read more

Query Custom Post by Category

Are these custom taxonomies or the regular categories? if they are just categories you should use: $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘news’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘category_name’ => ‘Alumni’ ); $loop = new WP_Query( $args ); <?php while ( $loop->have_posts() ) : $loop->the_post();?> … <?php endwhile; ?> if you want … Read more

How can i list custom post type categories?

This will list the 3 most recent posts from the post type us_portfolio. <?php $args = array( ‘posts_per_page’ => 3, ‘post_type’ => ‘us_portfolio’ ); $custom_query = new WP_Query($args); while ($custom_query->have_posts()) : $custom_query->the_post(); ?> <div class=”image bg-image” style=”background-image: url(‘<?php the_post_thumbnail_url(‘full’); ?>’)”></div> <?php the_category(); ?> <h3> <a title=”<?php the_title(); ?>” href=”https://wordpress.stackexchange.com/questions/289627/<?php the_permalink(); ?>”> <?php the_title(); ?> </a> … Read more

Query to get the author who having maximum number of post (custom post type)

You can try with the following query, where the author data as well as the post count can be retrieved. $sql = “SELECT SQL_CALC_FOUND_ROWS wp_users.ID,post_count FROM wp_users RIGHT JOIN (SELECT post_author, COUNT(*) as post_count FROM wp_posts WHERE ( ( post_type=”custom-post-type” AND ( post_status=”publish” ) ) ) GROUP BY post_author) p ON (wp_users.ID = p.post_author) WHERE … Read more

Beginner question: Accessing functions.php through admin web interface in order to import custom post types?

It is sometimes possible to edit theme files, including functions.php, inside wp-admin. Many hosts and devs disable this feature since it can cause security issues as well as allow you to break the site. So if you can access the file via FTP, that’s generally the recommended method. If you don’t see “Appearance > Editor” … Read more

Custom Post Type slug same as page name causing a conflict

What is appearing at http://www.example.org/team-members/ is the ‘post type archive’ for your post type. It’s the automatically generated list of posts created by WordPress. If you don’t want the post type to have an archive you can disable the archive by setting the has_archive argument to false: register_post_type( ‘post_type_name’, array( ‘has_archive’ => false, ) ); … Read more

Admin List Dynamic Heading

When you take a look at wp-admin/edit.php, you’ll see that this string is printed with this line: echo esc_html( $post_type_object->labels->name ); So there is no filter to modify it in edit.php. There are no filters in get_post_type_object also, so we can’t change it in there too, but… The object for given post type is stored … Read more

WP_Query with custom post_type and cat retrieving unwanted posts with the custom posts

Assuming that you have a CPT with slug projets and you’ve registered built-in categories for that CPT, it all looks correct. So there are two possibilities, that I would check: Typos – maybe you misstyped your CPT name somewhere in your code. pre_get_posts filter is modifying your query and changing its behavior (it’s pretty common … Read more

Working with Next and Prev links in Single Taxonomy Templates

The next_post_link() and previous_post_link() functions take in_same_term parameter, which is set to FALSE by default. You will find a complete description of the functions here and here. in_same_term (boolean) (optional) Indicates whether previous post must be within the same taxonomy term as the current post. If set to ‘true’, only posts from the current taxonomy … Read more