Getting a GET error in console – 404 not found for wp-json

The URL you’re using is not the URL that you’ve registered. This code: register_rest_route( ‘news’, ‘/news’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘custom_api_get_news_callback’ )); Registers this URL: http://localhost:8888/una/wp-json/news/news But you’re sending requests to http://localhost:8888/una/wp-json/news/all-posts Nowhere in your code have you defined an all-posts endpoint. You either need to change /news in register_rest_route() to /all-posts, or … Read more

Assigning alternate single-{cpt} template based on blog_id in multisite

Actually, I noticed that your closure is not capturing/using the proper $template variable which is passed from the template_include filter hook: // This hook is defined in wp-includes/template-loader.php $template = apply_filters( ‘template_include’, $template ) The closure is also not returning the template.. So your closure should look like: add_filter( ‘template_include’, function( $template ) use ( … Read more

How to add a lightbox to class mix?

If you only need to add a “lightbox” class to each element you just need to change this : echo'<div class=”mix ‘.$item_classes.'”>’.get_the_post_thumbnail().'</div>’; to this : echo'<div class=”mix lightbox ‘.$item_classes.'”>’.the_post_thumbnail(‘thumbnail’, array(‘class’ => ‘lightbox’)) .'</div>’; And if you want to add the full size image to be opened, try this : $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),’full’); echo'<div class=”mix lightbox … Read more

How to approach a site where it has sub-businesses, each with its own pages (“articles”, “staff”)? Don’t want to use WP multisite

Logic suggests that: “Services” is taxonomy. “Catering” and “Wedding” are parent terms. “Staff” and “Articles” are child terms. “About Parent Term”, “Person N” and “Article N” are either CPTs, posts or pages. “About Us”, “Our Staff” and other accessories are the set of hierarchical pages or whatever.