This is how your shortcode should be set up:
function short_birthday( $atts, $content = NULL ) {
extract( shortcode_atts( array(
'year' => 'default value'
), $atts ) );
list( $Y, $m, $d ) = explode( "-", $year );
$data = date( "md" ) < $m.$d ? date( "Y" )-$Y-1 : date( "Y" )-$Y;
return $data;
}
add_shortcode( 'birthday', 'short_birthday' );
Related Posts:
- shortcode to output multiple images urls from media library id
- How to link to current post in WordPress?
- Get new WordPress slug from old wordpress slug
- WordPress basic functions show on top in custom shortcode
- Is there a way to show attachment IDs on the attachment info screen?
- Do shortcodes in title before permalink is generated
- get_posts displaying wrong permalink for “continue reading” link
- Stop WordPress appending `-2` to the end of my url after i change it
- WordPress Permalinks not working in Apache2 Ubuntu 14.04
- Get current URL (permalink) without /page/{pagenum}/
- Removing the redirect after changing a page’s slug
- How to display a public profile page for registered users with custom slug?
- How does wordpress keep track of post id when post id is not used in permalinks?
- Permalink Issues by Installing WordPress in Subdirectory / Subfolder
- How to add query parameters to all internal links?
- How to make draft posts or posts in review accessible via full url / slug?
- nginx – permalinks with .php in url not working
- Social Media Links on homepage – within posts/post loop
- Nice RSS Feed URLs for each custom post type
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- removed index.php now all pages 404
- Permalinks all messed up, I am helpless [closed]
- WordPress | Convert #038; to &
- Can’t get rewrite rules working
- permalink changed, now getting 404 for every pages
- How to write correct add_rewrite_rule in WordPress for more than one taxonomy in one rule?
- How to add category to the permalink and breadcrumb?
- Get permalink to page?
- Permalinks not working Apache + CentOS 7
- How can I link a file in admin with a button?
- Remove Dash/Hyphen From WordPress CustomPosttype Permalink
- Auto-create a pretty permalink for a bunch of posts
- Post incorrectly displaying as page
- wp_logout_url redirects to incorrect page because of pagination
- Moved page (new parent) loads properly using obsolete URI. Why?
- Only default permalink is working mod_rewrite enabled
- Custom Permalinks for Posts only
- How to add a variable as a tag base?
- Is it possible for a custom post type and sub pages of a page with the same slug as the custom post type to share a slug?
- AddToAny shortcode in the loop
- Why is page/2/ not working?
- Removing leading zeros from custom permalink structure
- Integrating wordpress into existing site and setting up htaccess?
- Permalinks stopped working – NO update, mod_rewrite enabled, .htaccess not touched
- Add more structure tag to permalink?
- wp_publish_post to saved draft, permalinks broken
- display dynamic content based on url slug on custom page
- How to generate a list of all urls
- Slugs Disappeared Leaving 404s – Quick way to repopulate?
- Path to Pages Resolves to Archive instead of Actual Content
- permalink %year% of pre-written posts to be published next year, in the mysterious future (*)
- Changing permalink name redirects to another template?
- Permalink slug no longer editable when using post_type_link filter
- add_query_vars and canonical links
- Changing the permlink and SEO
- whats the mistake → href=”get_permalink() [closed]
- Remove some rewrite rules in wordpress
- How to change permalinks
- How can I link to the author’s page
- WordPress pages and posts are redirecting to server IP address instead of domain URL [closed]
- Would it be wrong to save the permalinks as a postmeta and regenerate it on save post? [closed]
- How to: change permalink by category?
- new page redirect to old page which had the same permalink
- Edit permalink for old posts and not show on top of RSS feed
- Long permalinks get split with multidots and get broken
- Page content doesn’t display when published but does when previewed as draft?
- Will permalinks work if blog is transferred to subdirectory?
- Permalinks and page store
- How to make different urls for some tags pages
- Change pemalink for one single post without redirect
- Strip subcategory base from URL
- How to change specific permalink in wordpress site?
- assets aren’t loading on a page but loads on others? slug permalink conflict?
- remove SLASH on single_post but KEEP on categories and parent pages
- Change Project permalink to custom URL
- Edit Post Permalink option removed, looking for possible causes
- Site Tagline ended up in permalink
- Got 404 error when changed siteurl via DB in WordPress
- Permalinks don’t update nor link properly
- Getting 400 Bad request Error when trying to open posts after updating to wordpress 5.0
- Why I had to re-save permalink setting after moving my WordPress site to another hosting provider?
- Permalinks custom base to redirect to archive.php
- Pretty Filter URL
- get_permalink to an anchor
- Add URL to selected post in meta box
- Add Custom Pagination Permalink
- Prevent guessing slug
- Pretty permalinks to work for lighttpd webserver?
- Pages included in another page and duplicate content issues for SEO
- WordPress archive posts returns user to homepage
- URL to an image in a post is changing when permalink is set to custom. Can I avoid this?
- How can i edit all posts slug in bulk keeping WP native redirect?
- Post/page without slug
- permalinks url with woocommerce
- Blog url disappears
- Error: “Sorry, this content could not be embedded” when using the Embed block
- WordPress Permalinks 404 Not Found
- WordPress not remembering old slugs for pages
- make a new structure tag that does some processing
- Website appears with wrong permalink in Google’s search