AM Events
The purpose of this plugin is to add an event type similar to the normal post type. By design this plugin doesn’t provide any ready-made layouts, and allows the events to be fully integrated and customized to the theme of your choosing. Current Features Admin pages to view/create/modify events. Available data fields for events: start date, end date, venue, category Create weekly or biweekly recurring events Fully customizable widget for displaying upcoming events. The custom post type created by the plugin is named ‘am_event’ and has two taxonomies: ‘am_event_categories’ and ‘am_venues’. Dates are stored as post metadata. Displaying the events is done in the theme files using WP_Query and the template tags provided by the plugin. This allows full control over the layout and what elements to show. The widget for displaying upcoming events uses a simple template system for full control of the layout. If you think something critical is missing, feel free to send me a request. The plugin is available in the following languages (pot-file included for additional translations): English French Norwegian Finnish TUTORIAL For integrating AM Events to an existing theme, I suggest creating a child theme with custom page templates. You can find an example of a working Twenty Twelve child theme from https://github.com/attemoi/am-events-child-theme containing three different page templates for event pages. Widget Here are the shortcodes available in the upcoming events widget template. [event-title] [start-date] [end-date] [event-venue] [event-category] [content] [thumbnail] [excerpt] [permalink] [meta] Conditional shortcodes: [if cond=”startdate-is-enddate”] [if cond=”startdate-not-enddate”] [if cond=”startday-is-endday”] [if cond=”startday-not-endday”] [if cond=”has-venue”] [if cond=”has-category”] The title can be linked to the event post with the ‘link’ attribute, e.g. [event-title link=true] The category and venue can also be linked similarly to their respective archive pages using the ‘link’ attribute, e.g. [event-category link=true] The number of words displayed in the title, content or excerpt can be limited by the ‘limit’ attribute, e.g. [content limit=25] or [event-title limit=10]. The dates can be formatted using the ‘format’ attribute, e.g. [start-date format=’d.m.Y H:i’] (see PHP date for formatting options). If no format is given, the default WordPress date format is used. You can use any shortcode as many times as needed in a single template. To separate date and time of start date for example you could write: [start-date format='d.m.Y'] divider [start-date format='H:i'] Example usage of conditional shortcode: [start-date format='D d.m.Y H:s'] [if cond='startdate-not-enddate'] - [end-date format='D d.m.Y H:s'] [/if] Template tags Template tags were introduced in version 1.3.0 and are listed below. More documentation can be found in the source files. // Template tags for getting and displaying event dates am_the_startdate($format = 'Y-m-d H:i:s', $before = '', $after = '', $echo = true) am_get_the_startdate( $format = 'Y-m-d H:i:s', $post = 0 ) am_the_enddate($format = 'Y-m-d H:i:s', $before = '', $after = '', $echo = true) am_get_the_enddate( $format = 'Y-m-d H:i:s', $post = 0 ) // Template tags for getting and displaying event venues am_get_the_venue( $id = false ) am_in_venue( $venue, $post = null ) am_get_the_venue_list( $separator = '', $parents='', $post_id = false ) am_the_venue( $separator = '', $parents='', $post_id = false ) // Template tags for getting and displaying event categories am_get_the_event_category( $id = false ) am_get_the_event_category_list( $separator = '', $parents='', $post_id = false ) am_in_event_category( $eventCategory, $post = null ) am_the_event_category( $separator = '', $parents='', $post_id = false ) Example of displaying the first category of the current event post: $categoryArray = am_get_the_event_category(); echo $categoryArray[0]->name; Creating a WP_Query The custom post type is named ‘am_event’ The taxonomies are named ‘am_venues’ and ‘am_event_categories’. The event post has metadata named ‘am_startdate’ and ‘am_enddate’ that are formatted like ‘yyyy-mm-dd hh:mm’ So suppose I wanted to display all events with a category of ‘other’ and venue ‘mcdonalds’. I would then make a WP_Query like this: $args = array( 'post_type' => 'am_event', 'post_status' => 'publish', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'am_venues', 'field' => 'name', 'terms' => 'mcdonalds', ), array( 'taxonomy' => 'am_event_categories', 'field' => 'name', 'terms' => 'other' ), ), ); $the_query = new WP_Query($args); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); $postId = $post->ID; // Use template tags to get start and end date $startDate = am_get_the_startdate('Y-m-d H:i:s'); $endDate = am_get_the_enddate('Y-m-d H:i:s'); // Use template tags to get venues and categories in an array $venues = am_get_the_venue( $postId ); $eventCategories = am_get_the_category( $postId ); // All the other functions used for posts like // the_title() and the_content() work just like with normal posts. // ... DISPLAY POST CONTENT HERE ... // } } If you want the events ordered by start date, add the following to $args: 'orderby' => 'meta_value', 'meta_key' => 'am_startdate', 'order' => 'ASC', If you need to display only upcoming events, add the following meta_query argument to $args: 'meta_query' => array( array( 'key' => 'am_enddate', 'value' => date('Y-m-d H:i:s', time()), 'compare' => ">", ), ), The plugin folder also contains a file “examples.php”, which contains an example function for displaying upcoming events in a table.
Top keywords
- event18×2.01%
- post17×1.90%
- events13×1.45%
- ''12×1.34%
- format12×1.34%
- template11×1.23%
- category10×1.11%
- date9×1.00%
- s'9×1.00%
- venue9×1.00%
- displaying8×0.89%
- tags8×0.89%
Dynamic Month & Year into Posts
Automate your SEO Insert dynamic dates anywhere in your WordPress content using simple shortcodes: Years: [year] (current), [nyear] (next), [pyear] (previous) Months: [month] (January), [mon] (Jan), [nmonth]/[pmonth] (next/previous) Dates: [date] (full date), [dt] (day number), [weekday] (day name) Age: [age date="1990-05-15"] calculates years from any date Season: [season] displays current season (supports hemispheres) Countdowns: [daysuntil date="2025-12-25"] and [dayssince date="2020-01-01"] Post Dates: [datemodified] and [datepublished] shortcodes. Event Dates: [blackfriday] and [cybermonday] shortcodes. Block Editor support: Toolbar to quickly insert the shortcodes, customizable date and countdown blocks. Works in posts, pages, titles, widgets, and SEO meta. Renders in your WordPress language. Perfect for affiliate marketers, bloggers, and anyone who wants evergreen content that updates automatically. But that’s not it. See Full List of Shortcodes New: Display current season with [season] shortcode. Supports hemisphere: [season region="south"] for Southern hemisphere. New: Calculate age with [age date="1990-05-15"] shortcode. Add ordinal suffix with ordinal="true" (e.g., “35th”). New: Post dates with [datemodified] and [datepublished] shortcodes. New: Event dates with [blackfriday] and [cybermonday] shortcodes. Gutenberg Blocks Four dedicated blocks for the Block Editor: Dynamic Date Block – Insert any dynamic date with live preview: Select date type from dropdown (year, month, date, age, season, etc.) Configure age format (years only, years & months, full breakdown) Set ordinal suffix for age display Typography and color controls Spacing options (margin, padding) Live Countdown Block – Real-time countdown powered by WordPress Interactivity API: Count days until or since any date Auto-updates without page reload, even when the page HTML is cached Repeat the countdown annually Customizable label text Correct singular and plural day labels Typography and color styling Perfect for event promotions and milestones Published Date Block – Display the post’s publication date: Uses WordPress date format from Settings Custom format support Typography and color controls Modified Date Block – Display the post’s last modified date: Uses WordPress date format from Settings Custom format support Typography and color controls All blocks are found under “Widgets” category in the Block Inserter. Plus, a toolbar button in the formatting toolbar lets you quickly insert any shortcode into text blocks. Works with popular SEO Plugins Supports RankMath, Yoast and SEOPress plugins and can be used to replace all their date based variables. [year] works as a replacement to %currentyear% , [month] as a replacement to %currentmonth% already. Use various combinations to make your articles even more dynamic and make your content always SEO ready — no matter the date or year. Extremely useful for Affiliate Marketers, Amazon Affiliates and Copywriters. Tested Support With Rank Math Rank Math Pro SEOPress SEOPress Premium Yoast SEO Yoast SEO Premium SureRank Gutenberg and Block Editor Content, Headings and Buttons All popular Block Editor Addons, including Greenshift, GenerateBlocks, Ultimate Blocks, Kadence Blocks, Spectra, Otter Blocks. Elementor Page Builder WP Bakery Page Builder Visual Composer Beaver Builder Brizy Builder Oxygen Builder Bricks Builder Jetpack Related Posts Intelly Related Posts a.k.a. Inline Related Posts (IRP) Advanced Custom Fields (Manual: please see the FAQs) Lightweight Accordion (including Schema) All major themes including Twenty Twenty-Five, Twenty Twenty-Four, Twenty Twenty-Three, Twenty Twenty-Two, Twenty Twenty-One, Twenty Twenty, Astra, Neve, Hello (Elementor), Kadence, GeneratePress, Blocksy, and OceanWP. Tested to be totally working with Yoast SEO, SEOPress and Rank Math’s breadcrumbs, custom meta titles, excerpt etc. Note: Since August 2021, Google has started showing h1 titles in search results, this plugin becomes even more useful as no other SEO plugins adds Current Month, Current Year or Today’s Date in h1 titles except this; keeping the same in SEO meta as well. More features Full Rank Math OpenGraph Support. Full Schema and OpenGraph support in YoastSEO. Multiple Langauge (WPML) Support: Shortcode renders your site’s defined language. Contextual Related Posts Support. Jetpack Related Posts Support. Totally native. Doesn’t write anything to the database. No configuration required. The Live Countdown corrects cached day counts in the browser. Easy to use Just install the plugin (see Installation tab) and activate it. Add [year] to render current year, [nyear] to render next year, [pyear] to render previous year, [month] to render current month (full name) and [mon] to render first three letters of months automatically. See Full List of Shortcodes (You can also see this link in Plugins page in your WordPress dashboard). As the months & years change, these shortcodes get updated into the content and title automatically on the shortcode locations. Zero bloat. Editor assets load only in the editor, and frontend JavaScript loads only for the Live Countdown block. Shortcode rendering makes no plugin database queries. Ordinary shortcodes are server-rendered, so configure your page cache to expire or purge when a cached year, month, date or age should change. Also, Dynamic Month & Year into Posts is a totally free plugin. There are no upsells and will never be. More details Free Support More WordPress Plugins and Web Tools WordPress Deals Request a Feature Privacy Dynamic Month & Year into Posts by Gaurav Tiwari is a completely native shortcode plugin. It has no settings page and does not use any analytics tool to gather or use your data. It’s bloat and ad-free. No notifications. No upgrade notices. Nothing. Fast Support and Feature Implementation I will provide instant support for all your queries or feature requests. Use support forum to ask your questions, request new features or report something broken. I will also update the plugin for every major and minor WordPress version. Compatibility I use the plugin myself on my primary website and other client sites that I run. I try my best to ensure that this plugin is compatible with every functionality plugin you use. Please let me know if this plugin isn’t compatible with your stack, create a support request and allow me some time. Please note that some plugins strip shortcodes or disable rendering of shortcodes. In such cases, it’s impossible to implement dynamic dates without rewriting the whole plugin code and breaking a couple of things. But still, I’ll give a try. Help me with a positive review to keep the development going.