get_adjacent_post – in same term not working

The arguments for get_adjacent_post is not formatted correctly. $excluded_terms needs to be either a string or an array. Also be careful with the category. If ‘portcats’ is a category name and not a taxonomy, that won’t work. This is looking for posts that are in the same ‘portcats’ taxomony with certain terms in ‘portcats’ excluded. … Read more

Include scheduled ( future ) posts in WordPress post navigation ( previous_post_link, next_post_link )

You can do this by using the get_{$adjacent}_post_where filter. Basically all we are doing is replacing the part of the query that says “find published posts” with “find published or future posts”. /** * Amend the ‘WHERE’ clause in the SQL query to find an adjacent post * * @param required string $where The default … Read more

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

Harman, don’t use get_posts() when pagination is required. You may also accomplish this task using WP_Query. Refer to this answer explained beautifully by Chip Bennett at How to fix pagination for custom loops? <?php $user_fav = get_user_favorites($user_id); $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $args = array( ‘posts_per_page’ => … Read more

Tweak next_post_link for it to include thumbnail

If you have a look at what next_post_link you’ll see that it takes a parameter $link as the second argument: next_post_link( $format, $link, $in_same_term = false, $excluded_terms=””, $taxonomy = ‘category’ ); Your parameter for this currently doesn’t include the post thumbnail: _x( ‘%title <span class=”meta-nav”>&rarr;</span>’, ‘Next post link’, ‘nicosite’ ) So we need to add … Read more

altering %title

Unfortunately, your logic doesn’t quite work out. The reason is because the order of operations, just like math, works inside to outside. So, your short_title() function is running with just passing the string %title, which then returns, I assume, the same string because that string meets your requirements. Then it passes %title onto previous_post_link and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)