Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter Dave Navarro, Jr.

    (@dnavarrojr)

    I managed to figure it out.

    Could u please describe, how u did it?
    If other users have the same question.

    Thanks for confirming that you got this sorted, dnavarrojr! If you happen to review this thread and have a chance to share the solution, I’m sure shadow772 and others in a similar position would appreciate it.

    dnavarrojr – please post up your solution! I’m trying to achieve the same result as shadow772 as well. I have been scouring the net for hours searching for a solution and have had no luck! 🙁

    Thread Starter Dave Navarro, Jr.

    (@dnavarrojr)

    I have to go back through the code to remember what I was doing. I’ll do that in a couple of days when I’m back home. I’m out of town for work.

    No worries, that would be great! Thanks so much 🙂

    Thread Starter Dave Navarro, Jr.

    (@dnavarrojr)

    I completely forgot that I backed up the site before I left and took a copy of the backup with me.

    In the file:

    views/events-list-load-widget-display.php

    I have the following:

    <li <?php echo $class ?>>
    	<div class="when">
    		<?php
    			$space = false;
    			$output = '';
          $s_dt = tribe_get_start_date( $post->ID, false );
          $e_dt = tribe_get_end_date( $post->ID, false );
    
          echo tribe_get_start_date( $post->ID ); 
    
          if( tribe_is_multiday( $post->ID ) || !$event->AllDay ) {
            if( $s_dt != $e_dt ) {
              echo ' – '. tribe_get_end_date($post->ID);
            } else {
              echo ' - '. str_replace( $e_dt . ' ', '', tribe_get_end_date( $post->ID));
            }
          }
    
          ?>
    	</div>
    	<div class="event">
    		<a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a>
    	</div>
    </li>

    I ended up comparing the start and end date and if they matched, I removed the end date from the output string.

    You sir, are a legend! Thanks so much for this code dnavarrojr! I’m sure many other people will appreciate you sharing this as well 🙂

    Just another quick question (hopefully quick!)…

    I know that within the plugin’s current capabilities in the WP admin area, it doesn’t allow you to NOT SET an end date/time. So you can set a start date/time, but basically you’re “forced” to set an end date/time – because in some instances you might just want to set a start date/time and NO end date/time.

    Do you have any ideas on how one would get past this?

    I had a thought – just for example – say you set the START date/time to “23 March 2013 6:00pm”, then you set the SAME date/time for the END date/time – Do you think you would be able to write code that checks against this and “just doesn’t apply an end date/time”?

    I hope that made sense! Thanks in advance for your help if you’re able to help 🙂

    No need to stress dnavarrojr, I’ve figured it out myself mate! It was pretty easy, once I actually looked at your code a bit further than the end of my nose! Haha! Here’s what I did:

    <li <?php echo $class ?>>
    	<div class="when">
    		<?php
    			$space = false;
    			$output = '';
          			$s_dt = tribe_get_start_date( $post->ID, false );
          			$e_dt = tribe_get_end_date( $post->ID, false );
    
          			echo tribe_get_start_date( $post->ID ); 
    
          			if( tribe_is_multiday( $post->ID ) || !$event->AllDay ) {
    				if( $s_dt != $e_dt ) {
    					echo ' – '. tribe_get_end_date($post->ID);
    				} else if( $s_dt == $e_dt ) {
    					echo '';
    				} else {
    					echo ' - '. str_replace( $e_dt . ' ', '', tribe_get_end_date( $post->ID));
    				}
    		 	}
          		?>
    	</div>
    	<div class="event">
    		<a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a>
    	</div>
    </li>

    Actually… No, that didn’t work! Grrr! My bad! I’m gonna keep tinkering but I think I still need help with this one please 🙁

    All done! I’m pretty darn sure that I got it correct this time! Hopefully this helps other people out there with the same problem 🙂

    <li <?php echo $class ?>>
    	<div class="when">
    		<?php
    			$space = false;
    			$output = '';
          			$s_dt = tribe_get_start_date( $post->ID, false );
    			$s_dt_time = tribe_get_start_date( null, false, 'g:ia' );
          			$e_dt = tribe_get_end_date( $post->ID, false );
    			$e_dt_time = tribe_get_end_date( null, false, 'g:ia' );
    
          			echo tribe_get_start_date( $post->ID ); 
    
          			if( tribe_is_multiday( $post->ID ) || !$event->AllDay ) {
    				if( $s_dt != $e_dt ) {
    					echo ' – '. tribe_get_end_date($post->ID);
    				} else if( $s_dt_time == $e_dt_time ) {
    					echo '';
    				} else {
    					echo ' - '. str_replace( $e_dt . ' ', '', tribe_get_end_date( $post->ID));
    				}
    		 	}
          		?>
    	</div>
    	<div class="event">
    		<a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a>
    	</div>
    </li>
    jonahcoyote

    (@jonahcoyote)

    Hi existonline, thanks for sharing your solution! Hopefully this helps others.

    existonline

    (@existonline)

    No worries jonahcoyote! I was just stoked to have figured that part out, but it wasn’t all me – dnavarrojr was a big help also from the beginning of the topic 🙂

    jonahcoyote

    (@jonahcoyote)

    Awesome, thanks again! And thank you dnavarrojr!

    existonline, thanks for the code snippet. Saved me a headache!

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘tribe_is_multiday returning true, falsly’ is closed to new replies.