As most template tags that start with the_
this one echoes time and not returns it (which template tags that start with get_the_
do).
First the_time()
fires and echoes year, then its return (null
) gets concatenated and echoed with string.
So:
echo 'Archive for ';
the_time('Y');
Or:
echo 'Archive for ' . get_the_time('Y');
Related Posts:
- How to get WordPress Time Zone setting?
- Converting timestamps to local time with date_l18n()
- PHP function showing wrong time in WordPress
- How to get year, month and hour in WordPress?
- WordPress returns a wrong date
- How to check for WordPress timezone type?
- Unable to set right time in admin and frontend template
- Convert a date to ISO8601 date format
- wrong php date()?
- display month in french in wordpress/php?
- Displaying the Month and Year that a page was Created?
- Get date numerical and separate?
- Print last modified date only on posts
- Find hours between post_date and post_date_gmt
- 3 different times on my WordPress website
- How to get User Time Zone in WordPress?
- Check If Post Was Published More Than 6 Months Ago Using get_the_date
- How do I check or test a WordPress Auto Year Change Script?
- Shortcode function doesnt work without caption
- Comparing Dates from custom field
- Get date function not working
- PHP time function ($today) for GMT +1
- Hide publish date when update date
- If Post Published Date or Modified Date is 1 Year or Older, Display Notice on Post Page
- How to detect and handle the time difference between server and user in WordPress?
- No more get_option(‘date_time’) in WordPress 5.5?
- WordPress wrong dates bug
- How to pull date/time in french format for wordpress post?
- Can’t add to time? [closed]
- Ordering / grouping posts by datepicker ACF
- Array sorting assistance
- Adding a number to a date
- Display Year and Month from custom field + Age Calculator
- Can i show items based on the day with php?
- Display Current Time using shortcode
- How do I convert a custom field to a php date format? [closed]
- Change date/time format in custom plugin
- Convert custom field date format to “WordPress default”
- Creating a WordPress form with a PHP script and default header
- Can we have a php “page” without a WordPress “page”?
- API JSON Data in WordPress
- How To add custom radio boxes to WooCommerce Billing page and change total price by this field?
- PHP Code stuck in Cache [Memcached] [closed]
- jQuery .each to get post meta and subtract from a sum
- Store and Work with huge array in WP [closed]
- Static variable and add_rewrite_rule?
- Generate YouTube image thumbnail in a Gutenberg block – ACF + Timber
- How to upload a file to a folder named after the user_id via plugin
- Can’t access variable outside for loop
- add custom link to wordpress media gallery modal
- adjust section according to country?
- How to Reference/Echo Variable from Another PHP Function
- Issues when changing == to ===
- How do I modify the custom footer text and get theme version number to show in wordpress admin?
- linking stylesheets and scripts with functions.php
- Double jQuery loaded
- Make a database query using WordPress
- Liking a facebook page from wordpress website?
- Get the last 5 products from each category
- Admin-ajax php not working on new wordpress version
- Fatal error: Cannot redeclare function
- Issue Enqueueing WordPress style.css
- Add valid XHTML closing img tags to WordPress galleries
- Convert canvas to image and upload image to server
- Only load certain artists on this page
- Using flickr api in custom wordpress plugin
- How to Redirect Buddypress Directories To Login Page For Non Logged in Users
- Prevent Buddypress Rewrite Rules on Non-Buddypress pages/posts
- Woocommerce order status payment
- Display logged in user name and lastname on page
- How to Add a cutsom slug to my custom author role
- How to set a parrent page to single-post
- Reading URL Parameters
- Issue in displaying the ongoing event and current events in the post
- If is_page include/else not working all of a sudden
- Attach and retrive multiple pdf files to post or page
- Link to index.php from home.php?
- Merging Multiple WordPress Websites
- Replace an array (with identical values) with another array in the_content
- WordPress/NGINX not respecting the category URL for new posts
- Display current user metadata on WordPress page
- Need help transforming echo to return for use with shortcode
- PHP Error Backtrace / create_function deprecated
- Filtering markers on google map by WordPress category[SOLVED]
- Parsing webhook from Shopify in WordPress
- scroll scrpit to particular button position to next id when click button
- Check if a user is logged into my WordPress site which is on a different server
- How to add text before posts
- perform mathematical operation on shortcode
- WordPress / PhpStorm / XDebug and plugin_dir_path issues
- Allow the execution of an external PHP script for logged users
- Do_shortcode on PHP file outside theme ALMOST works
- WordPress 2014 Theme – Featured Content with multiple tags?
- How to display the date under the post title?
- What is proper way to use the php if statement? [closed]
- Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\admin\products.php on line 148 [closed]
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- Need help with conditional logic for menus
- Disabling User Email Notifications for Erase Personal Data Utility
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only