Text-captions for featured images in mobile.php

Home Forums Calendar Products Events Calendar PRO Text-captions for featured images in mobile.php

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #963797
    Nicola
    Participant

    Hello again, on my website I do show text-captions below featured-images. I do that using

    <?php echo tribe_event_featured_image()->post_excerpt; ?>

    in the template files.

    This works almost everywhere, except that I cannot get it to work in month/mobile.php. The line will return the same text-caption for all images.

    Now I have looked into this thread:
    https://theeventscalendar.com/support/forums/topic/captions-for-featured-images-on-tribe_events-posts-not-displaying/
    And I see that it can probably be done. I have also tried things out with the snippets posted in the thread but I can’t figure it out.

    Can you help me please?
    Kind regards,
    Nicola

    #963987
    George
    Participant

    Hey Nicola,

    We unfortunately don’t offer support for customizations here, but we can at least take a look at your custom code for a bit 🙂 Can you paste your mobile.php file, un-edited, into a Gist at http://gist.github.com? Then, share a link to that Gist with us here and we’ll take a look at it and see if we can learn anything.

    Thank you!
    George

    #964119
    Nicola
    Participant

    Hello George,
    here you can find my mobile.php: https://gist.github.com/anonymous/cf0193db26af724a56a7

    The problem is on line 37 where the text-caption for the featured image above should be returned. This works in all other parts of the website, including the events calendar list/single, etc. pages. But in mobile.php it will return the same caption for all images.

    #964214
    George
    Participant

    Hey Nicola,

    Thank you for posting that, I see your issue clearly and it’s basically because the mobile.php file is a JavaScript template, and you’re trying to customize it by simply echoing PHP into it.

    That will not work – while the whole process is a little outside the scope of the support forums, the Gist of customizing the mobile.php file is that you need to make content available to the file itself, and then reference it from the file.

    This can be seen with template variables in that file that look like this:

    
    [[=date]]
    

    Notice how that isn’t actually defined anywhere in the file with PHP? It’s defined in a JSON array that is passed to mobile.php, and the [[=date]] variable in mobile.php tells the file to look for this variable within that array.

    If that doesn’t make much sense, then the best step at this point would be to check out a few resources to learn how this all works.

    First, follow the instructions at the top of the mobile.php file itself:

    
    /**
     *
     * Please see single-event.php in this directory for detailed instructions on how to use and modify these templates.
     *
     */
    

    Check out that file and read through the entire documentation notes there.

    Another great resource is an example customization of the tooltip.php template from one of our developers, Gustavo. The file and data are different – instead of passing an excerpt to the mobile.php template, this customization passes Venue information to tooltip.php – but in both cases, a JavaScript template is being customized. Hopefully if you read through the code you should get a good idea of how the whole system works. You can even activate the code directly on your site and make modifications to it, just to see what connects to what.

    Check out Gustavo’s example modifications here → https://github.com/bordoni/tec-forum-support/tree/plugin-939516

    I hope this all helps Nicola!

    Cheers,
    George

    #964324
    Nicola
    Participant

    Hello George, thank you very much for this, I appreaciate that. I think it gives me an idea now where I need to look and what I need to learn and understand better.

    Kind regards,
    Nicola

    #964517
    George
    Participant

    Glad to hear it! Best of luck with your customizations Nicola – I’ll close this ticket for now, but if other questions or concerns arise, don’t hesitate to come along and open a new ticket any time 🙂

    Cheers,
    George

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Text-captions for featured images in mobile.php’ is closed to new replies.