WordPress custom posts generator
With this dynamic slide generator you can show the contents of your custom posts.
What are custom posts?
Plugins, which are storing multiple datas are usually saving down their contents as "custom posts". For example WooCommerce's products are custom posts, Events Manager's events are custom posts and you could even use this generator to display them. In WordPress this appears similarly to the image above, so the same way your regular WordPress pages and WordPress posts are displayed in a list. (By the way WordPress pages are custom posts as well.) This means, if you have a plugin, which shows your datas the same way in the admin area as you see in the top image, then most likely you will be able to use our slider to display its contents.
There are plugins like Custom Post Type UI, which are allowing you to create custom posts and also a lot of themes are creating custom post types for specific purposes. For example if you have a real estate theme, you might have an "apartments" or similar custom post type in it and if you have a cinema theme, you might have "movies" custom post type.
- Create a new slider, or use an existing one.
- Choose to give dynamic slides to your slider.
- Click on the WordPress Posts block:
- Set up your generator, choose the settings you think you want (see the meaning of the fields lower), change the number of slides to how many do you want to be in your slider, change the cache expiration to the time you want your slider to look for new data, and if you want to, you can check, what will be on your slides in the record viewer.
- Now you can start working on how your slides will look with the datas of the first slide. You can put down layers, and use the VARIABLE signs to put that data inside them, what you want there to be.
- If something is not clear, check out how the dynamic slide generators work. The simple WordPress posts generator has a very similar process, so if you wouldn't have seen its video, take a look at it!
- Taxonomies - Custom posts can have taxonomies, for example a post's category is a taxonomy, a tag is a taxonomy, etc., so the groups of your custom posts. You can filter based on these taxonomies and with the relation option you can select wether you want to get posts, where all the selected taxonomies are applied or where either one or the other applies.
The relation option only works between the different taxonomies, not within one taxonomy. For example if you only have categories taxonomy and you select two categories, the relation between them will always be OR. If you have two taxonomies, like categories and tags, select one category and one tag, you can use this relation option to choose AND or OR relation between them.
- Only display these posts - Only display posts with the given IDs.
- Exclude posts - Exclude posts with the given IDs.
- Post custom fields - Custom posts have meta keys, for example a product's price can be a meta key, and an event's starting date too. Basically these are the datas of your posts. You can compare these keys with values, for example you could show posts, where the "onstock" value is "yes".
Besides manually written texts or numbers, you can use some keywords too in "Field value".
- More post custom fields - The same as the previous one, but you can manually write down any number of comparisons.
- Post status - Posts can have different statuses, like "published", "pending", "confirmed" etc.. You can filter based on these.
- Post option - Posts can have options, like a post can be "sticky" or not. You can choose to only display posts, which are selected to be IN or NOT IN this option.
- Date & time - You can make our code try to identify your date and time values to format + translate them. For the formatting you can find the usable characters here.
(There isn't a PHP function, that can identify datetime values, because for example a simple number, like 1 could represent a time value too. So this is just a function written by us, which seems to work in most cases, but it is not a 100% working solution.)
Replace these timestamp variables: timestamps cannot be identified, as any positive number can be a timestamp, but if you enter the timestamp variable's name, like "starttime" (without quotemarks), then you can make our code turn them into dates, using the given format.
- Remove duplicates - If you enter one variable's name into the "Unique variable" field, then you will only have results, where the result of that variable is unique. For example if you use the 'image' variable and you have posts with the same images, one image will only be displayed once within your slider.
This code has to happen after the custom posts were asked down, so the "Slides" number at your generator's settings represents all the slides and the not unique values will be removed from that. To be able to manage this better, you could write a bigger number into the "Slides" field, to surely have the number of slides you want and with the Maximum slide count option you would be able to set the number of slides you actually want.
- id - The id of the post.
- url - Url to the post.
- title - The title of the post.
- excerpt - Excerpt of the post.
- modified - Date of the last modification.
- content, description - The content of the post.
- author, author_name - The display name of the post's author.
- author_url - Url to the website of the post's author.
- category_name - The name of the post's category.
- category_name_[x] - The name of the post's category. This variable was made, if you have multiple categories selected for your post, you can show more, not just the first one.
- category_link - Url to the post's category.
- category_link_[x] - Url to the post's category. This variable was made, if you have multiple categories selected for your post, you can show more, not just the first one.
- image, thumbnail, featured_image - The featured image of the post.
- image_[size] - Different image sizes for the featured image of the post.
- Advanced custom field variables. Advanced custom field stores their variables in many different ways, so it is not 100% that you can get all your variables!
- The meta datas of the post. Meta data can be stored in many different ways, so it is not 100% that you can get all your meta datas!
- Post date
- Modification date
- Given IDs - If you used the "Only display these posts" option, you can make them appear with the given order.
- Menu order - Posts can have manual ordering in WordPress and this would show your posts in that order.
- Order by custom field - If this option is used, the "Order - Field" setting won't be used anymore. Instead the meta data of the posts will be used. For example your events probably have EventStartDate or similar meta datas, which would allow you to show the events in the order they are happening. Other example is, that your products have prices and you could show your cheapest products.
Since you can store numeric and alphabetic values too, you have to select which one are you currently using for the ordering.
The Order - Ascending/Descending value will be used with this setting as well.
At the Post custom fields option you can use these keywords as the "Field value":
This value is generated by the WordPress given current_time function:
current_time('mysql');which produces this format:
You can compare this to dates having the same format.
This value is generated by the WordPress given current_time function:
which produces a Unix timestamp similar to this:
You can compare this to dates stored as timestamps.