Articles of next post link

Pagination for custom loop on custom page template is not displaying anything

I have created a page where user can see his favourite post which has been bookmarked by him get_user_favorites($user_id); This function is responsible for returning me all the favourite posts bookmarked by user in an array. I am using this approach to get the data from the database and make it work inside my Custom […]

Tweak next_post_link for it to include thumbnail

I am using a fork from underscores.io, and there is this code: next_post_link( ‘<div class=”nav-next”>%link</div>’, _x( ‘%title <span class=”meta-nav”>&rarr;</span>’, ‘Next post link’, ‘nicosite’ ) ); Wich prints the next post link, How Can I use it (or alternatives) to include the post’s thumbnail? -edit- Right now, I have next_post_link( ‘<div class=”nav-next”>%link</div>’, _x( ‘%title <span class=”meta-nav”>&rarr;</span>’, […]

Get ID for previous/next image link

For grabbing previous or next image link on attachment page we can use this https://codex.wordpress.org/Function_Reference/previous_image_link How do we get ID for that attachment? Because I would like to get its alt title by using this echo get_post_meta(get_the_ID(), ‘_wp_attachment_image_alt’, true); and put it below image, with maybe also a few more stuff.

Get next post in same category not working WP 4.7.4

I have posts which assigned 1 of 2 different categories. On the single post view i want to show a next and previous link of posts with the SAME category. This should be straightforward, i’ve tried using get_previous_post etc but i cannot exclude posts assigned to the other category. I’ve tried $prevPost = get_adjacent_post(TRUE,’129′,TRUE); where […]

Disable “previous link” in first post and “next link” in last post

how can I disable “previous link” in first post and “next link” in last post? thank you

Featured Image Link to next post?

Hello i wonder if anyone knows this is possible? A post featured image click to view next post…? For example.. <a href=”next-post”> <?php the_post_thumbnail(‘post-thumbnails’); ?> </a> I assume its something from the WordPress pagination, as when it gets to the final post/image it needs to go back to the first one. Any idea if it […]

Making next_posts_link(); return posts by month

I’m building a site for a magazine using WP and am needing to display a month of posts at a time. How would I make the next_posts_link(); and previous_posts_link(); functions return results, shorted as one month per page? If I can’t do it via those functions, how would I make the front page display in […]

excluded_categories parameter in next_post_link() behaving unexpectedly

I have a WordPress template with a single.php page. The page has “next” and “previous” arrows to allow navigating through all posts. I want to exclude posts from some categories from being included in the “next” and “previous” calculation. I have this code: // in single.php next_post_link( ‘%link’, ‘&larr; Previous’, false, ’11 and 13 and […]

next_post_link / previous_post_link not working with WP_Query

I am trying to add next and previous page buttons to my template, but when I try to use either next_post_link or previous_post_link, it just does not work. Could it be because I am using WP_Query? Here is my code thus far, <?php get_header(); ?> <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; ?> <?php […]

next_posts_link and previous_posts_link problem

Below is the code from my author.php file. The problem is that next_posts_link and previous_posts_link only generate links based on the number of posts in the blog authored by the author in question, not the number of posts in the query ( which includes pages and events). I have used WP_Query to add the custom […]