In the Oxygen's Facebook group a user asked:

Hi, How do i have Easy Posts post 1 category in a random order?

Making the above work involves

  • getting a list of all categories
  • looping through the above list and storing the IDs of all the categories in an array
  • writing a custom query + loop where in we pass a random ID from the above array as the value of "cat" and ask WP to pull just 1 random post from that category.

As can be seen from the logic, there are a few moving or dynamic parts to achieve our end goal and as such, this is not possible using Oxygen's Easy Posts component.

This members-only tutorial provides the steps to use a Code Block component to pull one random post from a random category using a custom WordPress query with the loop part taken from one of the Easy Posts' presets.

Step 1

In the Oxygen editor, add a Section.

Add a Code Block inside.

PHP & HTML:

This is a premium members-only content.

To view the rest of the content, please sign up for membership (one-time payment for lifetime access).

Already a member? Log in below or here.

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: