View more link in the event list widget (pro)

Home Forums Calendar Products Events Calendar PRO View more link in the event list widget (pro)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1000305
    Sören
    Participant

    Hi there,

    in the list-widget.php located at events-calendar-pro\scr\views\pro\widgets\ there is the following line:

    	<p class="tribe-events-widget-link">
    		<a href="<?php esc_attr_e( esc_url( $link_to_all ) ) ?>" rel="bookmark">
    			<?php esc_html_e( 'View More&hellip;', 'tribe-events-calendar-pro' ) ?>
    		</a>
    	</p>
    

    Is it possible to show this only, if there is only 1 event in the widget? Cause i have a one page design in which i use the widget with only 1 event and the second widget with show 10 events.

    I want to modify the link to the position eg

    	<p class="tribe-events-widget-link">
    		<a href="/#programm" rel="bookmark">
    			<?php esc_html_e( 'View More&hellip;', 'tribe-events-calendar-pro' ) ?>
    		</a>
    	</p>

    But if i do this, i have also the link in the second widget and if you click on show more – nothing happens cause it links to itself. So i need an if function or an idea how to set up an second event list widget.

    Thanks for your help.

    #1000522
    Josh
    Participant

    Hey Sören,

    Thanks for reaching out to us!

    You can definitely accomplish this by making a couple of modifications to the list-widget.php file.

    First, you can add a “$count = 0” to the top of the file. Then, within the “foreach( $posts as $post)” loop, you can add a “$count++”

    This will cause the “$count” variable to increase by “1” for each event that is to display within the widget. You can then do a conditional based on the count around your custom code to target the first instance of an event.

    Let me know if this helps.

    Thanks!

    #1004334
    Sören
    Participant

    Okay thanks, this worked for me:

    <?php
    	if($count<=1) {
    ?>
    		<p class="tribe-events-widget-link">
    		    <a href="/#programm" rel="bookmark">
    		        <?php esc_html_e( 'View More&hellip;', 'tribe-events-calendar-pro' ) ?>
    		    </a>
    		</p>
    <?php
    	}
    ?>
    #1005086
    Josh
    Participant

    Hey Sören,

    Awesome! I’m glad you were able to find a solution that worked for you!

    I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new thread.

    Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘View more link in the event list widget (pro)’ is closed to new replies.