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 - WordPress Tutorial
From the course: WordPress Development: Coding Practice
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,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Dynamic copyright year2m 50s
-
(Locked)
Randomize posts5m 37s
-
(Locked)
Get post meta3m 19s
-
(Locked)
Change admin colors based on the server5m 18s
-
(Locked)
Create your own block pattern5m 58s
-
(Locked)
Append a message to RSS content5m 31s
-
(Locked)
Sanitize input4m 39s
-
(Locked)
Sanitize output4m 4s
-
Add a sitewide banner to the top of the page3m 32s
-
(Locked)
Register a custom post type5m 37s
-
(Locked)
Store user meta5m 29s
-
(Locked)
Send an email to the admin when a plugin is activated6m 42s
-
(Locked)
When a user logs in, greet them by their name4m 44s
-
(Locked)
Create a transient5m 30s
-
(Locked)
Hide content based on a query string5m 49s
-
-