To just get the post date, you can replace that entire section of code with just the get_the_date() function.
To display the article’s date, use this code:
<?php echo get_the_date(); ?>
Check out the date format options on the codex page linked above to customize it to your liking, if necessary.
Related Posts:
- Check if a menu is empty?
- How To Make Connection To WordPress Data Base In A Plugin?
- WordPress Template Engine?
- Walker class: Problems with understanding how walk() method can be called without error
- How to get the post count for the last x days filtering by categories
- How to create shortcodes that pull custom field data from general settings
- Where exactly do I write define( ‘WP_DEBUG’, true ) in wp-config file
- How to display related posts from parent category
- Making a follow button, Ajax not talking to php
- get understrap pagination to work with custom query
- Replace existing content from specific WooCommerce admin orders list column
- Warning when using
- How to break down importing of feeds
- WordPress shows registration link for non logged users
- How to get woocommerce cart content without an action?
- How can I resolve the php notice “Constant EMPTY_TRASH_DAYS already defined”
- Use wp_get_recent_posts with search term
- multiple if statements [closed]
- Escape post image attachments added to template
- Choose To Display Post Views With An Options Panel
- Prevent Data Resubmission On Page refresh
- Bridging TinyMCE js and WordPress PHP?
- Echo URL of large version of Featured Image
- Remove price from Woocommerce variable product dropdown menu
- Getting trackpacks/pingbacks for a post via wordpress?
- Why is my cookie not unsetting upon logout? [closed]
- Loop through categories and display posts title under each dropdown
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- How to remove role=”navigation” from all nav elements?
- how to query a post based on previous page post ID
- How to use $_GET function WordPress backend
- How to set variable, pass it to a partial file and remove it after?
- is there a benefit in using a constant over get_stylesheet_directory_uri?
- wp_dropdown_pages auto submit
- How to loop through all the attached images in a post, and get their url one by one
- Use Tags to initiate Search
- How to send form data from WordPress (Meta Box) to an OData service?
- Noindex Posts From Certain Authors In WordPress
- Pass Variables or Variable Place-Holder from Editor to PHP
- Issue with custom loop in Archive page
- WooCommerce pages looks unstyled
- WP Query Leads to 502 Bad Gateway (Timeout Because Query Takes Too Long)
- Get the_content surrounded by instead of
- WordPress forms submissions and PHP files
- how to make an array of post id’s in is_single
- Display an image based on field value
- Loading Posts & Category with Ajax
- WordPress call post-ID in jquery
- Enqueueing a code block from an options framework
- List all anchor links on a page
- Assign Custom classes to every Excerpt
- Don’t display a sidebar widget when on a specific page
- Auto create Nextgen Gallery on post creation [closed]
- Hide media for non logged in users
- Generate images with html2canvas and the woocommerce api
- display the months of a specific category
- How to display 8 posts in four columns and 2 rows on a carousel slide?
- How to run php code only for a specific widget on a page and not all widgets on that page?
- excep tonly one css, don’t load any css
- is_front_page is not working in my functions.php
- Is it possible to update the dataset using update_post_meta
- Add Link to PHP message
- Hide payment method based on user role AND minimum cart value
- WooCommerce function not working correctly after moving from the functions.php into a class
- How to check if plugin update process completed in wordpress?
- Filter for product subcategory listing page load
- Conditional Banners
- Reduce Stock Based on Custom Variation Field Rather than Attribute (Working Script)
- Install functionality for push notifications but WP-Theme has oddly-named, hidden source files [closed]
- How can I get the custom post title?
- how to use auth_redirect() redirect visitor to login page if they are not login when they click account and order page?
- CRON job to update wp_usermeta value each day or week based on server time
- Query to show average # of months all accounts with specific role have been active
- Send email to users when they get new followers
- Conditionally change WordPress core language
- Remove item from post_meta array via AJAX
- Use PHP to inject HTML into before page renders?
- Query doesn’t display text data with apostrophes
- WooCommerce Custom Tab with ACF Repeater Field
- My WP Website Shows HTTP ERROR 500
- add menu page in loop menu order
- CSS loading as empty file in Custom Theme
- Calling WordPress hook from within a class: call to undefined function error
- soap request in wordpress for a fedex pickup request [closed]
- Dynamically Create Posts Via XML File
- pages disable after wordpress update
- How to only fetch certain Tag ID’s
- How to set a cookie based on a page Get variable?
- Editing the contents of just one div on a page from wordpress
- Postmeta not saving
- How to change the menu color
- Display latest 5 posts on homepage
- Display Current Time using shortcode
- How to pass parameter to another url?
- HTTP 500 Error after Creating Shortcode
- Show button in header when product custom field is not empty
- Why a class property becomes empty?
- how to goto specific page number including title with permalink
- get_the_term_list give me a whitespace
- How to get the last date updated of postmeta?