Show 5 posts and than 3 posts offset with pagination

under settings – reading, set ‘blog pages show at most’ to 8 then use conditional statements based on the current post number in the loop; <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php //conditionally outputting the opening tags for the first section if( $wp_query->current_post == 0 ) { ?> <div class=”posts-wrap”> … Read more

Help on Wp_query to print an term

If you want to output/print the term name look at this within the loop: https://developer.wordpress.org/reference/functions/get_the_terms/ $terms = get_the_terms( get_the_ID(), ‘pwb-brand’ ); You will need to output within the loop similar to this: <?php $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); $terms = get_the_terms( get_the_ID(), ‘pwb-brand’ … Read more

XMLRPC pingback.extensions.getPingbacks not work with parameters

Note that WordPress ships with WP_HTTP_IXR_CLIENT that extends the IXR_Client. So replace require_once ABSPATH . WPINC . ‘/class-IXR.php’; $rpc = new IXR_Client( ‘http://localhost/wordpress/wordpress/xmlrpc.php’ ); with: require_once ABSPATH . WPINC . ‘/class-IXR.php’; require_once ABSPATH . WPINC . ‘/class-wp-http-ixr-client.php’; $rpc = new WP_HTTP_IXR_CLIENT( ‘http://localhost/wordpress/wordpress/xmlrpc.php’ ); Then try replacing: $result = $rpc->query( ‘pingback.extensions.getPingbacks’, ‘http://localhost/wordpress/wordpress/2018/01/17/hallo-welt/&post_type=something’ ); with $result = … Read more

Show posts from categories instead of tags

In the function wp_get_post_terms() you can select the taxonomy. the default is post_tag you can change it to category. And in the WP_Query args you need to change the tag__in to category__in. // get the categories $categories = wp_get_post_terms($post->ID, ‘category’); if ($categories) { $categories_ids = array(); foreach($categories as $individual_cat) $categories_ids[] = $individual_cat->term_id; $args=array( ‘category__in’ => … Read more

Wp_query ordering problem

From what I understand the $productArrayShop is array of all the products ids. So you first don’t need all the distances. what the point to get the distances? You just need all the products IDs and to order them by the meta_value. BTW this order should be in the first loop instead of re-query for … Read more

WP_Query: custom orderby (not ASC nor DESC)

You probably can find some way to make MySQL do the sort for you, but an alternative approach is to make it into an ASC/DESC order by adding additional meta in which you put a numeric sort order value based on whether it is apple, bag, etc and update it when the post is saved. … Read more