This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

formatting dates in Vertical Results list

Home Forums Product Support Forums Ajax Search Pro for WordPress Support formatting dates in Vertical Results list

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18415
    vladtheinhalervladtheinhaler
    Participant

    I 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?

    #18422
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    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!

    #18437
    vladtheinhalervladtheinhaler
    Participant

    Hi 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?

    #18439
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    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!

    #18444
    vladtheinhalervladtheinhaler
    Participant

    This 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. . .

    #18448
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘formatting dates in Vertical Results list’ is closed to new replies.