Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter DVBPaul

    (@dvbpaul)

    The main issue is the Time/Date/Month translation, but the echoing the start and end time of an event is an other issue, do I need to create a diffrent post for it?

    Thread Starter DVBPaul

    (@dvbpaul)

    Hi,

    No and yes, the custom code we used comes from a website that also uses crossdomain/sub-sites and we used it on a website with only 1 domain,

    Down below you can see the code:

    function get_evenementen($id) {
    		global $wpdb;
    
    		if( get_option('dbem_events_default_orderby') == 'event_start_date,event_start_time,event_name'){
    			$orderby = 'startdate, starttime, a.post_title';
    		}else if( get_option('dbem_events_default_orderby') == 'event_name,event_start_date,event_start_time'){
    			$orderby = 'a.post_title, startdate, starttime ';
    		  $order = get_option('dbem_events_default_order','ASC');
    		}else if( get_option('dbem_events_default_orderby') == 'event_name,event_end_date,event_end_time'){
    			$orderby = 'a.post_title, enddate ,endtime';
    		}else if( get_option('dbem_events_default_orderby') == 'event_end_date,event_end_time,event_name'){
    			$orderby = 'enddate, endtime, a.post_title';
    		} else {
    			$orderby = 'startdate, starttime,  a.post_title';
    		}
    		$order = get_option('dbem_events_default_order','ASC');
    
    		$query = "SELECT a.ID AS postid, a.post_title, a.post_content, b.meta_value AS startdate, ( SELECT meta_value FROM wp_postmeta WHERE meta_key = '_event_end_date' AND post_id = postid) AS enddate,  ( SELECT meta_value FROM wp_postmeta WHERE meta_key = '_event_start_time' AND post_id = postid) AS starttime, ( SELECT meta_value FROM wp_postmeta WHERE meta_key = '_event_end_time' AND post_id = postid) AS endtime,( SELECT meta_value FROM wp_postmeta WHERE meta_key = 'external_link' AND post_id = postid) AS externallink FROM wp_terms c INNER JOIN wp_term_taxonomy d ON c.term_id = d.term_id INNER JOIN wp_term_relationships e ON e.term_taxonomy_id = d.term_taxonomy_id INNER JOIN wp_posts a ON a.ID = e.object_id INNER JOIN wp_postmeta b ON a.ID = b.post_id WHERE b.meta_key = '_event_start_date' AND taxonomy = 'event-categories' AND a.post_type = 'event' AND a.post_status = 'publish' AND c.term_id =".$id." ORDER BY ".$orderby." ".$order." ";
    
    		$result = $wpdb->get_results($query, OBJECT);
    
    		$k=1;
    		foreach($result as $key => $res) { if($k >3) break;
    			$st_date = $res->startdate;
    			$en_date = $res->enddate;
    			$ex_link = $res->externallink;		 
    
    			if($ex_link!='') { $ev_link = $ex_link; } else { $ev_link = get_permalink($res->postid); }
    
    			$current_date = date("Y-m-d")."</br>";
    			$end_date     = $en_date."</br>";
    			$current_date = $current_date;
    			if($end_date < $current_date) continue;
    			$expiry_date  = ($current_date - $end_date);
    			//echo htmlspecialchars($res->post_title);
    			//if ($expiry_date == -1) continue; ?>
    
    		<li <?php if(($key+1) == count($result)){?>class="last"<?php }?>>
    			<div class="calendar">
    				<span class="maand">
    					<?php echo date("F",strtotime($st_date));?>
    				</span>
    				<strong>
    					<?php echo date("d",strtotime($st_date));?>
    				</strong>
    			</div>
    			<p>
    				<a class="title" href="<?php echo $ev_link;?>">
    					<?php echo $res->post_title;?>
    				</a>
    			</p>
    			<p class="datum-text"><?php echo date("l d F Y", strtotime($st_date));  ?></p>
              		<p class="datum-text"><?php echo date("G.i", strtotime($st_date)); echo date(" - G.i ", strtotime($en_date)); ?> uur</p>
    			<p class="kosten-text"> <?php echo substr($res->post_content,0,50); ?> </p>	
    
    		</li>
    		<?php $k++; }
    }
Viewing 2 replies - 1 through 2 (of 2 total)