How can I get “Previous” and “Next” to show in the navigation besides the links?

You may like to use the_posts_pagination() instead of the_posts_navigation() or get_next/previous_posts_link(). The posts pagination function outputs a set of page numbers with links to the previous and next pages of posts. Example format would be like this below: <div class=”pagination_style”> <?php the_posts_pagination(array ( ‘prev_text’ => __( ‘PREV’ ), ‘next_text’ => __( ‘NEXT’ ), ‘screen_reader_text’ => … Read more

Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]

Try this code at the place where you want your gallery: <?php $images = acf_photo_gallery(‘gallery_images’, $post->ID); /// gallery_images to slug pola galeria w ACF if( count($images) ): foreach($images as $image): $full_image_url= $image[‘full_image_url’]; $class = get_field(‘gallery_images_class’, $id); echo ‘<img src=”‘.$image[‘full_image_url’].'” class=”‘.$class.'” >’; endforeach; endif; ?> Do try to check if ‘$id’ gives you the image/post id … Read more

How to hide post in WordPress

I think you need in your query is post__not_in but you aren’t showing any code: taken from WP_Query: $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘post__not_in’ => array( 2, 5, 12, 14, 20 ) ) ); if you want to exclude that particular post you’re in you would do: ‘post__not_in’ => array($post->ID), Other questions … Read more

Sort posts in a specific way

This is possible with native query parameters like this: $posts = get_posts([ ‘post__in’ => [2,5,3,1,4,6], ‘orderby => ‘post__in’, ]); This combination will instruct WP to fetch specific posts by ID and order them in the specific way that you supplied IDs.

How can get all users by current user meta?

You can achieve this using get_users function and its meta_key argument as displayed below. $users = get_users(array( ‘meta_key’ => ‘blocking_users’, )); var_dump( $users ); To retrieve it for current user and print it, please use below code. $user_id = get_current_user_id(); $key = ‘blocking_users’; $single = false; $blocking_users = get_user_meta( $user_id, $key, $single ); echo ‘<p>The … Read more

Calculate days between two custom field value dates

We can use something like human_time_diff() to give us a readable time difference. First we need to see if the days are the same: $date1 = get_field( ‘date_start’, false, false ); $date1 = new DateTime( $date1 ); $unix1 = strtotime( $date1->format( ‘Y-m-d’ ) ); $date2 = get_field( ‘date_fin’, false, false ); $date2 = new DateTime( … Read more

Comapare get_user_meta value

You can use meta_key or meta_query to fetch users where get_user_meta() ‘val’ == 1 Option 1: $users = get_users(array( ‘meta_key’ => ‘val’, // your_meta_key ‘meta_value’ => ‘1’, // value you want to compare ‘meta_compare’ => ‘=’, )); Option 2: $args = array( ‘meta_query’ =>array( array( ‘key’ => ‘val’, //your_meta_key ‘value’ => 1, // value of … Read more

.html end of URl affected to SEO?

If you currently have /path/to/site.html and change it to /path/to/site, this will affect SEO, as search engines think they know the url (the former). However, there are solutions to this. You can either keep the .html at the end of the URL (there should be no problem to use a WordPress permalink with .html in … Read more