Group Custom post type in a taxonomy page by its child taxomony

I got it! Seems a little confused at first, but the logic is here: <?php $term = get_queried_object(); ?> <?php echo $term->name; ?> <?php $children = get_terms( $term->taxonomy, array( ‘parent’ => $term->term_id, ‘hide_empty’ => false ) ); if($children) { foreach ( $children as $child ) { ?> <?php echo ‘<li>’ . $child->name . ‘</li>’; ?> … Read more

How to display a WordPress Custom Field only on a specific day of the week?

You are not checking the current date correctly. You need to use current_time() funciton to get current datetime according to WordPress configuration. Then, using PHP date() you can check what day of week current date is: // Get current date time of WordPress in Unix timestamp format $timestamp = current_time( ‘timestamp’ ); // Get day … Read more

How to copy a custom field from the user’s CPT to the user’s normal posts

You can use the wp_insert_post action for when a user creates/saves a “normal” post, then find their custom post and copy over any fields you need: function wpse_203349_copy_post_meta( $post_ID, $post, $update ) { if ( $post->post_type !== ‘post’ ) return; $users_custom_posts = get_posts( array( ‘posts_per_page’ => 1, ‘post_author’ => $post->post_author, ‘post_type’ => ‘custom_post_type’, ) ); … Read more

How to get post type information?

I sometimes have no clue on which conditional to use is_singular(), is_post_type_archive() and what the post type is actually named for a certain plugin is_singular() will return true on any single post page This conditional tag checks if a singular post is being displayed, which is the case when one of the following returns true: … Read more

Direct form to a custom page template

A helpful clue would be to look at the URL in the address bar of your 404 page. A reliable approach for form action in WP looks like the snippet below. <form method=”post” id=”thisform” action=”<?php bloginfo(‘url’); >/dbsearch/”> I would create your page in WP, ensure the page slug is ‘dbsearch’ as this determines your permalink … Read more