coloring row’s background based on custom field value

function add_custom_status_class( $classes, $class, $post_id ) { if ( ‘request’ === get_post_type( $post_id ) ) { $status = get_post_meta( $post_id, ‘hrs_field_status’, true ); if ( $status === ‘accepted’ ) { $classes[] = ‘status-accepted’; } elseif ( $status === ‘rejected’ ) { $classes[] = ‘status-rejected’; } } return $classes; } add_filter( ‘post_class’, ‘add_custom_status_class’, 10, 3 ); … Read more

How can I incldue a “private” post type in a loop for public users?

Figured it out, it was simpler than I expected. /** * Include catalog posts in archives, even though they’re not “public” * * @param WP_Query $query * @return WP_Query */ function wpse415668_catalog_posts_in_archives(WP_Query $query): WP_Query { if (! $query->is_admin() && $query->is_main_query() && $query->is_tax(“catalog_category”)) { $query->set(“post_type”, “catalog”); } return $query; } add_filter(“pre_get_posts”, “wpse415668_catalog_posts_in_archives”);