WordPress.org

Ready to get started?Download WordPress

Forums

Event-O-Matic
[resolved] Disable Links in eom-listings (1 post)

  1. sinble
    Member
    Posted 2 years ago #

    I had a requirement of not wanting the expand links for eom-listings for one page but still needed the functionality on a different page. So i modified the code to accept a attr nolinks=true.

    Here is my code for "event-o-matic.php"(please add it to the source if you want it. Will keep me from having to update it ever time there is a new release.)

    // eom listings. USE SHORTCODE [eom-listings] or [eom-listings when=archive] or [eom-listings nolinks=true]
    public function eomListings($atts){
    	extract(shortcode_atts(array('when' => 'upcoming'), $atts));
    	extract(shortcode_atts(array('nolinks' => 'false'), $atts));
    	if($when=='archive'){$when='archive';$direc='DESC';}else{$when='upcoming';$direc='ASC';}
    	$event = new Event;
    	if($_REQUEST['id']){
    		$event->put(array('id'=>$_REQUEST['id']));
    		$event->get(array('status'=>$event->statusCode['approved']));
    		$r = '<h1>'.stripslashes($event->name).'</h1>';
    		$r.= '<h2>'.date("F jS Y g:ia",strtotime($event->dateStart)).' - '.date("g:ia",strtotime($event->dateEnd)).' at ';
    		if($nolinks=='false'){
    			$r.= '<a href="#eomAddress">';
    		}
    		$r.=stripslashes($event->venueName);
    		if($nolinks=='false'){
    			$r.= '</a>';
    		}
    		$r.='</h2>';
    		if($event->price!=0.00){$r.='<p>Price: '.$event->price.'</p>';}
    		$r.= nl2br($event->description).'</p>';
    		if($event->url || $when=='upcoming'){$r.='<p>More details: <a href="'.clean_url($event->url).'" target="_blank" />'.clean_url($event->url).'</a></p>';}
    		if($event->image){$r.='<img src="'.clean_url($event->image).'" class="eomImage" />';}
    		$r.='<br style="clear:both;"><a name="eomAddress"></a>';
    		$r.= '<p><strong>'.stripslashes($event->venueName).'</strong><br />'.$event->venueAddress.'</p>';
    		$r.= '<div id="eomMap"></div>';
    		return $r;
    	}else{ //default
    	$p = new pagination;
    	$eventsCount=$event->getAll(array('status'=>$event->statusCode['approved'],'count'=>true,'when'=>$when));
    	$p->items($eventsCount); //get all records as count
    	$p->limit(30); // Limit entries per page
    	$p->currentPage($_GET[$p->paging]); // Gets and validates the current page
    	$p->calculate(); // Calculates what to show
    	$p->parameterName('paging');
    	if(!isset($_GET['paging'])) {$p->page=1;}else{$p->page=$_GET['paging'];}
    	$limit = ($p->page - 1) * $p->limit.", ".$p->limit; //Query for limit paging
    	$events=$event->getAll(array('status'=>$event->statusCode['approved'],'limit'=>$limit,'when'=>$when,'order'=>'dateStart','orderDirection'=>$direc));
    	if($eventsCount>0):
    		$r='<p>'.$eventsCount.' '.$when.' events.</p>';
    		$r.='<div class="tablenav"><div class="tablenav-pages">'.$p->getOutput().'</div></div><ul>';
    		foreach($events as $event){
    			$r.='<li>';
    			if($nolinks=='false'){
    				$r.= '<a href="'.add_query_arg(array('id'=>$event['id'],'vid'=>$event['venueId'])).'">';
    			}
    			$r.=stripslashes($event['name']);
    			if($nolinks=='false'){
    				$r.='</a>';
    			}
    			$r.=' - '.date("F jS Y",strtotime($event['dateStart'])).' - '.stripslashes($event['venueName']).'</li>';
    		}
    	$r.='</ul><div class="tablenav"><div class="tablenav-pages">'.$p->getOutput().'</div></div>'.$this->_linkLove();
    	return $r;
    	else:
    		return '<p>No events available.</p>';
    	endif;
    }
    
    }//END eomListings

    http://wordpress.org/extend/plugins/event-o-matic/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic