WordPress.org

Forums

All-in-One Event Calendar
How to Open Link in New Window / New Tab? (12 posts)

  1. alvbayu
    Member
    Posted 1 year ago #

    Hi,

    How to make links in the calendar (month view) open a single event page in new tab / in new window.
    I would like a new separated window opened when a user clicks an event title.

    I'd appreciate if someone could help me out with this. Please refer me to the file name that should be edited, and perhaps also how to edit it. Thanks!

    https://wordpress.org/plugins/all-in-one-event-calendar/

  2. Jashan
    Member
    Posted 1 year ago #

    Hello,

    Month view is controlled by file:
    wp-content/plugins/all-in-one-event-calendar/public/themes-ai1ec/vortex/twig/month.twig

    Edit this file to make changes, and make sure you clear cache from plugin folder to reflect changes.

    Take care

  3. alvbayu
    Member
    Posted 1 year ago #

    Hello Jashan

    Thanks for the reply.

    Unfortunately, I tried to change:

    <a href="{{ event.get_runtime( 'instance_permalink' ) | e('html_attr') }}"

    To following line:

    <a target="_blank" href="{{ event.get_runtime( 'instance_permalink' ) | e('html_attr') }}"

    But it does not make any change.
    Links (in month-view page) is still opened in same window.
    (I have cleared the plugin cache folder too)

    I'm new to this .twig things.
    Could you help me a little bit more by pointing me to a more detailed solution please?

    Thanks again!

  4. austenozzy
    Member
    Posted 8 months ago #

    This didn't work for me either.

    Any chance of a bit of direction here?

    Thanks!

  5. vkean2011
    Member
    Posted 7 months ago #

    I am needing help with this as well. I made the same change as alvbayu, cleared all caches, no luck.

    Thanks!

  6. nicola.peluchetti
    Member
    Plugin Author

    Posted 7 months ago #

    Do you have a folder called ai1ec_static in wp-content?

  7. vkean2011
    Member
    Posted 7 months ago #

    Yes, I sure do. There are appears to be no files in it though - empty.

  8. nicola.peluchetti
    Member
    Plugin Author

    Posted 7 months ago #

    Ok, try to do the following. Make the change in month.twig like i did on line 69 http://take.ms/MwBuV

    Then find file app/config/constants.php and find the line

    if ( ! defined( 'AI1EC_DEBUG' ) ) {
    		define( 'AI1EC_DEBUG', false );
    	}

    change it to

    if ( ! defined( 'AI1EC_DEBUG' ) ) {
    		define( 'AI1EC_DEBUG', true );
    	}

    and reload the calendar page. This should force an update

    REMEMBER TO REVERT THE CHANGES AFTERWARDS AS DEBUG MODE MUST BE OFF

    Sorry for shouting but it's important that yo do not have debug mode on, it adds about 5 second to each page load and triples the memory requirments

  9. vkean2011
    Member
    Posted 7 months ago #

    Nicola,

    Thanks for the response. My month.twig file does not look like yours... I checked that I have the most updated version of the plugin. Here is my month.twig file contents:

    {{ navigation | raw }}
    
    <table class="ai1ec-month-view ai1ec-popover-boundary
    	{% if month_word_wrap %}ai1ec-word-wrap{% endif %}">
    	<thead>
    		<tr>
    			{% for weekday in weekdays %}
    				<th scope="col" class="ai1ec-weekday">{{ weekday }}</th>
    			{% endfor %}
    		</tr>
    	</thead>
    	<tbody>
    		{% for week in cell_array %}
    			{% set added_stretcher = false %}
    			<tr class="ai1ec-week">
    				{% for day in week %}
    
    					{% if day.date is not empty %}
    						<td {% if day.today is not empty %}class="ai1ec-today"{% endif %}>
    							{# This div is needed for laying out multi-day event bars. #}
    							{% if not added_stretcher %}
    								<div class="ai1ec-day-stretcher"></div>
    								{% set added_stretcher = true %}
    							{% endif %}
    
    							<div class="ai1ec-day">
    								<div class="ai1ec-date">
    									<a class="ai1ec-load-view"
    										{{ data_type | raw }}
    										href="{{ day.date_link | e('html_attr') }}"
    										>{{ day.date }}</a>
    								</div>
    
    								{% for event in day.events %}
    									<a href="{{ event.get_runtime( 'instance_permalink' ) | e('html_attr') }}"
    										{{ data_type_events | raw }}
    										{% if event.is_multiday %}
    											data-end-day="{{ event.get_runtime( 'multiday_end_day' ) }}"
    											data-start-truncated="{{ event.get( 'start_truncated' ) ? 'true' : 'false' }}"
    											data-end-truncated="{{ event.get( 'end_truncated' ) ? 'true' : 'false' }}"
    										{% endif %}
    										data-instance-id="{{ event.get( 'instance_id' ) }}"
    										class="ai1ec-event-container ai1ec-load-event
    											ai1ec-popup-trigger
    											ai1ec-event-id-{{ event.get( 'post_id' ) }}
    											ai1ec-event-instance-id-{{ event.get( 'instance_id' ) }}
    											{% if event.is_allday %}ai1ec-allday{% endif %}
    											{% if event.is_multiday %}ai1ec-multiday{% endif %}"
    										>
    
    										<div class="ai1ec-event"
    											 style="{{ event.get_runtime( 'color_style' ) | e('html_attr') }}">
    											<span class="ai1ec-event-title">
    												{{ event.get_runtime( 'filtered_title' ) | raw }}
    											</span>
    											{% if not event.is_allday %}
    												<span class="ai1ec-event-time">
    													{{ event.get_runtime( 'short_start_time' ) }}
    												</span>
    											{% endif %}
    										</div>
    									</a>
    
    									{% include 'event-popup.twig' with {
    									'text_venue_separator': text_venue_separator
    									} %}
    
    								{% endfor %}
    							</div>
    						</td>
    					{% else %} {# day.date is not empty #}
    						<td class="ai1ec-empty"></td>
    					{% endif %} {# day.date is not empty #}
    
    				{% endfor %} {# day in week #}
    			</tr>
    		{% endfor %} {# week in cell_array #}
    	</tbody>
    </table>

    Also, when I made the change to the line in constants.php, it killed my site and deactivated the plugin :( I got this error message in my wp-admin are:

    All In One Event Calendar has been disabled due to an error:

    Argument 2 passed to Ai1ec_Persistence_Context::__construct() must be an instance of Ai1ec_Cache_Strategy, array given, called in /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/bootstrap/registry/object.php on line 160 and defined

    exception 'Ai1ec_Error_Exception' with message 'Argument 2 passed to Ai1ec_Persistence_Context::__construct() must be an instance of Ai1ec_Cache_Strategy, array given, called in /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/bootstrap/registry/object.php on line 160 and defined' in /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/cache/strategy/persistence-context.php:33
    Stack trace:
    #0 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/cache/strategy/persistence-context.php(33): Ai1ec_Exception_Handler->handle_error(4096, 'Argument 2 pass...', '/nas/wp/www/clu...', 33, Array)
    #1 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/bootstrap/registry/object.php(160): Ai1ec_Persistence_Context->__construct('ai1ec_parsed_cs...', Array, true)
    #2 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/bootstrap/registry/object.php(102): Ai1ec_Registry_Object->initiate('Ai1ec_Persisten...', Array)
    #3 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/css/frontend.php(73): Ai1ec_Registry_Object->get('cache.strategy....', 'ai1ec_parsed_cs...', Array, true)
    #4 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/bootstrap/registry/object.php(154): Ai1ec_Css_Frontend->__construct(Object(Ai1ec_Registry_Object))
    #5 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/bootstrap/registry/object.php(102): Ai1ec_Registry_Object->initiate('Ai1ec_Css_Front...', Array)
    #6 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/command/render-calendar.php(66): Ai1ec_Registry_Object->get('css.frontend')
    #7 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/lib/command/abstract.php(74): Ai1ec_Command_Render_Calendar->do_execute()
    #8 /nas/wp/www/cluster-2385/iwga/wp-content/plugins/all-in-one-event-calendar/app/controller/front.php(126): Ai1ec_Command->execute()
    #9 [internal function]: Ai1ec_Front_Controller->route_request('')
    #10 /nas/wp/www/cluster-2385/iwga/wp-includes/plugin.php(505): call_user_func_array(Array, Array)
    #11 /nas/wp/www/cluster-2385/iwga/wp-includes/template-loader.php(12): do_action('template_redire...')
    #12 /nas/wp/www/cluster-2385/iwga/wp-blog-header.php(16): require_once('/nas/wp/www/clu...')
    #13 /nas/wp/www/cluster-2385/iwga/index.php(17): require('/nas/wp/www/clu...')
    #14 {main}

    Now the plugin will not reactivate no matter what I do. I hate to uninstall and reinstall and lose all my settings and events etc.

    Needless to say, this is still not possible... Would be a great addition to the plugin, ideally with a simple check box in the options /settings area.

    Thank you.
    Torre

  10. nicola.peluchetti
    Member
    Plugin Author

    Posted 7 months ago #

    Hi,

    you would need to have it added here.

    {% for event in day.events %}
    <a href="{{ event.get_runtime( 'instance_permalink' ) | e('html_attr') }}" target="_BLANK"

    regarding the other error, do you have caching plugins active?

  11. vkean2011
    Member
    Posted 7 months ago #

    Yeah, that's where I put 'target="_BLANK" and it did not work. I host with WPEngine, and they have aggressive caching in place. I can ask that they exclude my calendar page from their caching. Do you think that would solve the issue? I know that even after I have used their 'Purge all caches' button this change has still not taken effect.

    Thanks!
    Torre

  12. nicola.peluchetti
    Member
    Plugin Author

    Posted 7 months ago #

    we've had issues with wpengine caches, try to turn it off. Just to be sure, when you edith month.twig, are doing it in a child theme? http://time.ly/document/customize-calendar/create-new-calendar-theme/

    Because we use twig for templates and twig templates comes pre cached... it might be that cache is not regenerated. you can also try to delete what's inside of the cache/twig folder

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • All-in-One Event Calendar
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic