Get events in the widget to open in new tab

Home Forums Calendar Products Events Calendar PRO Get events in the widget to open in new tab

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1109236
    threehillschamber
    Participant

    I want to get events in the widget to open in new tab

    #1109237
    threehillschamber
    Participant

    Would this work?
    if so, where do i put it?

    $(“#upcoming-events a”).live(“click”,
    function(e){
    $(this).attr(‘target’,’_blank’);
    });

    #1109531
    Geoff
    Member

    Hey Kevin and welcome to the forums!

    Javascript will certainly work and you can add that to your theme’s footer template, if you’d like.

    Another way to go about it is to do a template override for the widget. You can find out more about template overrides in our Themer’s Guide, but it breaks down to this:

    • Make a copy of the single-event.php template. It’s located at /wp-content/plugins/events-calendar-pro/src/views/pro/widgets/modules/single-event.php.
    • Make a new folder in your theme directory called tribe-events
    • Make a new folder in that one called pro
    • Make a new folder in that one called widgets
    • Make a new folder in that one called modules
    • Drop the copied single-event.php template in that last folder

    Now that the template is in your theme, you can modify it to suit your needs. In this case, change this:

    <h2 class="tribe-events-title">
    <a href="<?php echo esc_url( tribe_get_event_link() ); ?>" rel="bookmark"><?php the_title(); ?></a>
    </h2>

    …to this:

    <h2 class="tribe-events-title">
    <a href="<?php echo esc_url( tribe_get_event_link() ); ?>" rel="bookmark" target="_blank"><?php the_title(); ?></a>
    </h2>

    Does this make sense and will it work for you? Please let me know. 🙂

    Cheers!
    Geoff

    #1114512
    threehillschamber
    Participant

    This worked like a charm!

    #1114894
    Geoff
    Member

    Heck yeah, that’s great to hear! Thanks a ton for following up to let me know and definitely let us know if any other questions pop up — we’d be happy to help. 🙂

    Geoff

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Get events in the widget to open in new tab’ is closed to new replies.