Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › formatting dates in Vertical Results list
- This topic has 5 replies, 2 voices, and was last updated 7 years, 11 months ago by
Ernest Marcinko.
-
AuthorPosts
-
June 24, 2018 at 4:35 pm #18415
vladtheinhaler
ParticipantI enjoyed the excellent tutorial for using ASP for WP with The Events Calendar (https://wp-dreams.com/knowledge-base/events-search-the-events-calendar/) but I have one small display tweak that I can’t find in either the documentation or by exploring the UI. In Step 7 of the example, I see how to add the _EventStartDate to the results list, BUT in the tutorial the date display is in a simple F j, Y format and on my dev site it’s in the long, ugly format as stored in the database.
My question is: where can I set the display format of the date for the results list? I tried both the ASP admin controls and the Event Calendar controls but couldn’t find it in either place.
The only mention I see of controlling date format is on the Front End Search Settings tab, but that seems to be for a filter, not relevant to display. I’m sure this is a simple fix. . . can you show me what I’m missing?
June 25, 2018 at 9:38 am #18422Ernest Marcinko
KeymasterHi!
Tha date format in that case is requested from the WordPress ‘date_format’ option, more specifically, like this:
[php]$date= date_i18n( get_option( ‘date_format’ ), strtotime( $date) );[/php]
This internal date format can be changed under the WordPress date format panel: https://i.imgur.com/Uzlh0NZ.png
——————————–
If you prefer not changing this option, then instead of using the advanced title/description field, you can use a custom code:Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
June 25, 2018 at 2:41 pm #18437vladtheinhaler
ParticipantHi Ernest, and thanks so much for your fast reply. Unfortunately neither fix worked for me: the WordPress date format in Settings > General was already set to “F j, Y” and I plugged the code snippet into my child theme’s functions.php file, and I’m still getting the result shown in the attached screenshot. You can see this search in action at http://146.66.97.162/~britalli/region1hmcc.org/region1hmcc-event-calendar/ if that’s useful.
FWIW I’ve cleared the CDN cache (cloudflare), cleared the server cache, and cleared the browser cache (and tested in a fresh browser that had never visited this site before) so it looks like I’ve missed some small detail. Any advice on how to proceed?
June 25, 2018 at 4:23 pm #18439Ernest Marcinko
KeymasterHi,
I thought you try to use it in the results content, not the title 🙂 If you check the screenshot, it is already present in the content with the correct formatting. A minor modification to the code, and it will work with the titles as well:
I hope this helps!
June 25, 2018 at 6:54 pm #18444vladtheinhaler
ParticipantThis snippet is perfect, thanks so much! I hadn’t even noticed the previous one was adding the date to the content, I was so focused on the title field. D’oh. Hey, just FYI, as soon as I’d played with ASP for an afternoon, I left a *glowing* review on Code Canyon. I tagged it with “flexible” but noticed that many others had left 5* reviews with a “customer service” tag. Now I see why. . . I really appreciate the speed, thoroughness, and overall helpfulness of your replies. I’m still new to this plugin, but so far the features, UI, and customer service have made it one of my most satisfying experiences since I started working in WordPress years ago. Thanks a million. . .
June 26, 2018 at 8:07 am #18448Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- The topic ‘formatting dates in Vertical Results list’ is closed to new replies.