-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shortcodes, NavigationFooter): add global shortcodes and example…
…s for dynamic copyright notices (#297)
- Loading branch information
1 parent
f82743d
commit 00f9f6b
Showing
2 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
/** | ||
* Flynt Shortcodes | ||
*/ | ||
|
||
namespace Flynt\Shortcodes; | ||
|
||
/** | ||
* Current year | ||
*/ | ||
add_shortcode('year', function () { | ||
$year = date_i18n('Y'); | ||
return $year; | ||
}); | ||
|
||
/** | ||
* Site Title | ||
*/ | ||
add_shortcode('sitetitle', function () { | ||
$blogname = get_bloginfo('name'); | ||
return $blogname; | ||
}); | ||
|
||
/** | ||
* Tagline | ||
*/ | ||
add_shortcode('tagline', function () { | ||
$tagline = get_bloginfo('description'); | ||
return $tagline; | ||
}); | ||
|
||
/** | ||
* Flynt Shortcode reference | ||
*/ | ||
function getShortcodeReference() | ||
{ | ||
return [ | ||
'label' => __('Shortcode Reference', 'flynt'), | ||
'name' => 'groupShortcodes', | ||
'instructions' => __('A Shortcode can generally be used inside text fields. It’s best practice to switch to text mode before inserting a shortcode inside the visual editor.', 'flynt'), | ||
'type' => 'group', | ||
'sub_fields' => [ | ||
[ | ||
'label' => __('Site Title (Website Name)', 'flynt'), | ||
'name' => 'messageShortcodeSiteTitle', | ||
'type' => 'message', | ||
'message' => '<code>[sitetitle]</code>', | ||
'new_lines' => 'wpautop', | ||
'esc_html' => 0, | ||
'wrapper' => [ | ||
'width' => 50 | ||
], | ||
], | ||
[ | ||
'label' => __('Tagline (Subtitle)', 'flynt'), | ||
'name' => 'messageShortcodeTagline', | ||
'type' => 'message', | ||
'message' => '<code>[tagline]</code>', | ||
'new_lines' => 'wpautop', | ||
'esc_html' => 0, | ||
'wrapper' => [ | ||
'width' => 50 | ||
], | ||
], | ||
[ | ||
'label' => __('Current Year', 'flynt'), | ||
'name' => 'messageShortcodeCurrentYear', | ||
'type' => 'message', | ||
'message' => '<code>[year]</code>', | ||
'new_lines' => 'wpautop', | ||
'esc_html' => 0, | ||
'wrapper' => [ | ||
'width' => 50 | ||
], | ||
], | ||
] | ||
]; | ||
} |