Require()/Include() post template adding extra content

The problem is within the get_post function. After looking through the documentation for include() and require(), which includes the *_once() variations of the functions, the problem seemed to be that it was returning a Boolean on whether the template had been included/required or not without throwing an error. After changing how the template was requiring/including … Read more

Infinite next / prev post in single.php page

I think this is a better and cleaner approach of what you are trying to achive. // get_adjacent_post will return $post object $prev_post = get_adjacent_post(true,”,true); //Using get_the_post_thumbnail() to get featured image of previous post $prev_thumbnail = get_the_post_thumbnail( $prev_post->ID, array( 100, 100)); $next_post = get_adjacent_post(true,”,false); //Using get_the_post_thumbnail() to get featured image of next post $next_thumbnail = … Read more

random post redirect in wordpress with a .php file

My guess would be that go.php is located in the root of the WordPress install. The code in that fild would be something like this. <?php require ‘wp-config.php’; $post = get_posts([ ‘post_type’ => ‘post’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 1, ]); if (!empty($post)) wp_redirect(urldecode(get_permalink($post[0]))); This is a wild guess but it does the job. This … Read more