From the course: WordPress Development: Coding Practice

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Randomize posts

Randomize posts

- [Instructor] We want to increase views to other posts on our blog, so we are going to randomly display five other posts. The requirements, create an unordered list of five posts displayed as linked titles, which means we want to grab the title of the post and the permalink. You do not have to exclude the current post, the code I'm providing will not, but you can, we can discuss how you would do that. And the posts will be displayed in a shortcode, like other challenges in this course. Again, my solution may be different from yours, but that is okay. Here is the starting code, you can see we have our shortcode, and we have a little bit here, we have the query to get the random posts. So you're going to need to fill in the get_random_posts function, as well as send the output back to the shortcode. Pause the video here and when you are ready to see the solution, un-pause it. (bright music) Welcome back, all right,…

Contents