Appointment booking system in WordPress

The solution here ultimately depends on how this business functions and how these available appointment slots are structured. Not just in a ‘best case’ scenario, but also providing users with the ability to customize the output/availability of appointments. So, to start you have an ‘appointment’ custom post-type, this you’ve already built. This appointment CPT entries … Read more

SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop

SOLUTION: I looked through Divi’s functions.php & saw that the term for the project tags is ‘project_tag’, so when I amended my $query args it now works! Thank you very much to everyone who responded 🙂 $query_args = array( ‘post_type’ => ‘project’, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ‘posts_per_page’ => ‘3’, ‘project_tag’ … Read more

Create side bar widget showing list of years as hyperlinks for a custom post type

First, create the custom WordPress widget. This will query all the years that have at least one post for your custom post type “Meeting.” Save the following code in your theme’s functions.php file: class Meeting_Archive_Widget extends WP_Widget { public function __construct() { parent::__construct(‘meeting_archive’, ‘Meeting Archive’, array(‘description’ => ‘List Meetings by Year’)); } public function widget($args, … Read more

How to make 2 (or more) custom post type post pages sit under the same slug?

You were getting /video-demos-tours/post-name instead of /resources/post-name because the following line in your theme_build_post_args function is setting the rewrite slug to the post type slug (video-demos-tours): $args[‘rewrite’][‘slug’] = $slug; So you should fix that, but as for how, that is up to you. But then, although fixing that would give you the permalink structure you … Read more

Can’t expose custom field to REST API

I think the problem here is how you register the rest routes and how you return data for the single project endpoint. When you register the route and the callback like this. function single_project($data) { $post_ID = $data[‘id’]; return get_post($post_ID); } add_action(‘rest_api_init’, function () { register_rest_route( ‘project/v1’, ‘post/(?P<id>\d+)’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘single_project’, … Read more

WP Query filtering by custom category not showing all relevant posts

@jacob-peattie answered the question in his comment – I used the wrong key to set the number of posts my query generates. Swapping numberposts with posts_per_page solved the issue. Here’s the final query: @php $cats = get_sub_field(‘reviews_category’); // gets the custom field categories $args = array( ‘post_type’ => ‘testimonials’, ‘posts_per_page’ => -1, // this line … Read more

Show only taxonomy types terms associated with a custom post type in WordPress PHP

UPDATE The custom SQL query below can be used to produce a list of unique types taxonomy terms that have been assigned to newsroom posts. In PHP, you can call the function get_newsroom_types_terms to get the list: $terms = get_newsroom_types_terms();. Custom SQL query function get_newsroom_types_terms() { global $wpdb; $table_prefix = $wpdb->prefix; $taxonomy = ‘types’; $post_type=”newsroom”; … Read more