![]() The next step is to create one or more shortcodes that display today’s date. Create your shortcode for the current year (and current month, current date or current day) Allow shortcodes in widgetsĪdd_filter ('widget_text', 'do_shortcode') īonus! All the shortcodes described in this article can also be used in the body copy in your WordPress pages and posts. Then select functions.php in your child theme and add the following code at the end. But if you run an old version of WordPress, you need to add the code from this step first.īut luckily you can change that with a few lines of code in functions.php. Start in your WordPress dashboard and go to Appearance > Theme Editor (or even better, use an FTP client or the file editor in your web hosting account). Thus, you can skip directly to step 2 below. □ Update 2021: The current version of WordPress now allows shortcodes in widgets (and in the body content) by default. Unfortunately, WordPress default settings does not support shortcodes in widgets instead, it will only display shortcodes as plain text – (eg – when you publish. WordPress standard is that your footer (and sidebar) consists of widgets. which, if correctly implemented, automatically displays 2023 – and gets updated automatically at the same time as the New Year Eve’s fireworks are taking off. A shortcode consists of a word within hooks, eg. ![]() Allow shortcodes in WordPress widgetsĪ shortcode is a small code snippet that displays dynamic information, such as today’s date. ![]() How to create a WordPress child theme » Step 1. Otherwise, your changes will be overwritten next time that you update WordPress or your theme. Before we start – install a child themeīefore editing your php files, you should install a child theme on top of your parent theme. This works with all themes for WordPress, so you don’t have to use Divi from Elegant Themes. ![]() The old way: Add current year with custom code (for all themes and page builders)Īll code snippets you’ll need are available for copy & paste in the article.
0 Comments
Leave a Reply. |