WP REST API get all posts (or customs posts) for a React app

Firstly, the custom posts need to have the ‘show_in_rest’ => true, parameter set on post registration – see Adding REST API Support For Custom Content Types for more detailed instructions. Secondly, I then usually navigate to yoursiteaddress.com/wp-json/ for example https://blog.ted.com/wp-json/ – there you’ll see a play-book for all the routes you can play with in … Read more

WordPress pagination returns the same posts

You must change $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; To the following : $paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; There is a difference in page and paged for a static front page, You may find your Answer here : https://developer.wordpress.org/reference/classes/wp_query/#pagination-parameters Keep Posted

Why not showing all post by default in my jquery filter

@HappyArif You just kept a line in your code that needs to be changed if there is a Category selected. $args = array( ‘orderby’ => ‘date’, ‘post_type’ => ‘course’, ‘posts_per_page’ => -1, ‘tax_query’ => $tax_query, ); This have ‘posts_per_page’ => -1 which needs to be changed to ‘posts_per_page’ => 9, ‘paged’ => $paged to make … Read more

Why My slider shortcode display above header

You need to return the value from the output buffer, like this: //slider shortcode function slider_shortcode($atts) { extract( shortcode_atts( array( ‘id’ => ”), $atts)); $id = $id; ob_start();?> <div class=”gallary”> <?php // Check rows exists. if( have_rows(‘slider’,$id) ): // Loop through rows. while( have_rows(‘slider’,$id) ) : the_row(); $slider_image = get_sub_field(‘slider_image’); $slider_heading = get_sub_field(‘slider_heading’); $slider_text = … Read more

wordpress is generating too many Image Sizes

I fonud the answer here: https://gist.github.com/iftee/73cbd9f080c5c7a943cff5e806997f90?permalink_comment_id=3314876#gistcomment-3314876 I added: unset( $sizes[‘1536×1536’] ); unset( $sizes[‘2048×2048’] ); remove_image_size( ‘1536×1536’ ); remove_image_size( ‘2048×2048’ ); This removes the two big image sizes, but the -scaled image size is still there I found out this: When a new image is uploaded, WordPress will detect if it is a “big” image by … Read more

List unused javascript for easy removal

Is there a list somewhere of what each of these WordPress related javascripts do? There is no comprehensive list that does this, and many of those items would not appear on it as they’re not WordPress internal files or may be required by non-WordPress files to function. Those files may be built to require them … Read more

How do you order posts by type then term_id and then by date?

You can use the orderby parameter and pass it an array of what you want to order by in the order you want it ordered by: https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters This solves the problem of ordering by post type, and by date, but ordering by term slug or term ID is not something WP_Query can do. It may … Read more