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 ($37/month or $399 one-time).

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
magnifiercross
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: