Use the parameters of the shortcode with lowercase: [recurring_event short=”Wed” full=”wednesday”]
Try to follow the next code:
// NAV: Custom Code
function wpcoder_recurring_event_att( $atts ){
$date="";
$default = array(
'short' => 'Sun',
'full' => 'sunday'
);
$eventday = shortcode_atts($default, $atts);
date_default_timezone_set('US/Eastern');
if(date('D') == $eventday["short"]) {
echo date('F d, Y');
}
else {
// Create a new DateTime object
$date = new DateTime();
// Modify the date it contains
$date->modify($eventday['full']);
$date->modify('+1 day');
//output
echo $date->format('F d, Y');
}
}
// register shortcode
add_shortcode('recurring_event', 'wpcoder_recurring_event_att');
You can add the code in the file ‘functions.php’ or add using the free plugin WP Coder via the page Global PHP
Related Posts:
- Shortcode display outside the div
- creating html reusable blocks via shortcodes
- Redirect to another page using contact form 7? [closed]
- Shortcode Attributes to Return different $_POST
- strange shortcode error: does shortcodes requires any dependency?
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- How to add a shortcode button to the TinyMCE editor?
- Where do I put the code snippets I found here or somewhere else on the web?
- enqueue script only if it is not already enqueue
- Common functionality between my own plugins
- Autogenerate wordpress shortcodes using array?
- Why does including a file in theme’s functions.php not work?
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Editor access to plugin settings
- How To Ignore a Filter On Applying Filter the Content In a Function
- Saving Plugin settings to the database
- Shortcode under a Shortcode Multiple times Possible?
- Pass $this to function nested in another public function of the same class
- Add Top-Level Menu that opens URL
- shortcode doesn’t work
- How to add inline css/js inside a shortcode
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Placement of Code in Plugin for hooking `save_post`
- Scope for PHP Variables Assigned in functions.php or a plugin
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Demystifying and understanding shortcode nomenclature
- How to add class in plugin only for network site?
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- plugin development: problem with functions
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- Input with spaces in Shortcode attributes overwritten by defaults
- wordpress plugin is not activating from widget
- Allow users of my plugin to define their own shortcode rather than use mine?
- Edit Yoast SEO breadcrumbs output [closed]
- Adding Shortcode to Text Widget
- Display post lists in 2nd paragraph
- Using a post-signup hook to get user details
- Single API call exposed via shortcode with params
- Conditional attributes and logic per product category
- How to create a custom shortcode based on the layout?
- WordPress get_avatar function not correct working
- Which file of wordpress manage plugins functionalities?
- Difference and examples of esc_attr__() and esc_attr_e()
- What is @Action in WordPress?
- Check if variable is set in filter
- execute function after one completed
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- WordPress checkbox and Illegal string offset
- plugins_url() works everywhere but wp_reqister_script()
- IF condition based on wp_remote_get output
- Add the_post_thumbnail_url to a shortcode in function.php
- My widget won’t update its values when save is clicked
- How can i listing current category and Featured Category post list?
- Adding a Tag Parameter / Filter to My Shortcode
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- grab or load text on demand
- auto activate plugin when theme is active
- Checkbox show / hide output result
- How to keep plugin (media-sync) running even the tab is closed?
- Where do I put the code snippets I found here or somewhere else on the web?
- How to upload large media file in chunks, without any plugin?
- Allow a particular user to access a particular plugin?
- Thumbnail image doesn’t show up in Shortcode output
- list of custom post by custom field in frontend
- Cookie value changes back to previous value after changing
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Shortcode do not return the right data in post
- function post to trash problem
- How to call function in WordPress on button click?
- Hide content for specific users with id
- adding dynamic/multiple slug values in ‘option_none_value’
- Is admin section completely customizable in terms of styling?
- WordPress environment not loading properly
- WordPress Add advertising ads befor and after content with periority [closed]
- Can plugin automatically update if i hide the update notification?
- Why isn’t my plugin seeing other classes?
- Hook into install email
- wordpress Shortocode running twice?
- Shortcode in a blog post, footer and related products stop working
- shortcode which is introduced into entry the blog, and appears in side bar
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- WordPress plugin options need to delete after deactivate & uninstall
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- Shortcode registered from a plugin not recognized
- How to Overwrite validate_plugin function
- How to add a handler for a button in plugin?
- Custom Function for SEO by Yoast plugin
- Doing action based on input from options menu
- Call current post parameters inside a plugin
- How to list posts that appear in two categories
- How use Dynamic hyperlink on each wordpress post?
- Send email notification when meet the condition
- Create WordPress category dynamically
- wp_enqueue_script doesn’t load JS in plugin
- Mixed results with is_page() WordPress function, when using $this, or self
- Read page- or post-content across different builder-plugins
- WooCommerce Checkout – Validate User Role