A WordPress plugin that displays a lists of posts from a specific category.
- Download the plugin to Your computer.
- Upload and unzip the plugin into Your WordPress plugins directory.
- Go to the Dashboard -> Plugins and activate it.
- Use it.
For now, the plugin only has a Shortcode. To use it, simply copy and paste the following shortcode to one of Your posts/pages/other:
[nmv_posts_grid category="The Category"]
Where "The Category" is the category You want to display posts from.
The shortcode includes the following options:
- category: The name (not the slug) of the category Your posts are in. Default: Eventos.
- quantity: How many posts to display. Default: 30.
- container_class: A CSS class to add to the container. Default: Empty.
- display_order: Should the posts be ordered in descending or ascending order? Default: ASC (the only other option being DESC').
- order_by: Orders the posts by the specified custom fields value. Default: Empty. For now only two fields are recognized for the order:
- nmv_pg_date: orders the posts by a valid date (format: YYYY/MM/DD).
- nmv_pg_index: a numeric value.
- is_gallery: a value set to true or false. If true, then each of the posts is expected to contain only images, without anything else (apart from the custom fields values). In this case, the posts are shown just as before, but instead of opening the post page, an image gallery overlay is shown.
- hide_show_more: hides the "show more" link at the bottom of each item.
The following custom fields are recognized:
- coming_soon: set to true or 1 means that the post is not ready yet, but You still want to show something (coming soon event, for example). Default: not set.
- nmv_pg_url: if set, and the option is_gallery is not set or set to false, then clicking the post will lead the user to this url instead of the post.
- nmv_pg_nogallery: if the option is_gallery is set to true, but there are no images to display yet, then You can set this option to true or 1 (or anything, really) and the plugin will not load the gallery when the post is clicked. Once the gallery is ready, simply remove this value or set it to 0 or false. Default: the plugin assumes the gallery is set.
- nmv_pg_caption: a subtitle that's displayed below the post title. Default: empty.
To add these values, go to Your dashboard -> Posts -> Select the post You want to show. Under the Custom Fields section, click on Add New Value and enter the name and value You want.
If You cannot see the Custom Fields section, then click on Display Options (top left corner) and check the related option.
- WordPress, of course.
- Wordpress Plugin Boilerplate, this plugin base.
- PHP, what would we be without it...
- Slick JS, when the gallery is active, this is the plugin creating it.
- Masonry, used to display the posts.
Thanks to anyone that takes the time to test this plugin and provides Me any feedback.
You can get in touch through My Website.
- Added masonry to display the posts.
- Return an empty div if the shortcode category is empty or not set.
- This is the initial plugin.