Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Created June 27, 2012 03:41
Show Gist options
  • Save zanematthew/3001237 to your computer and use it in GitHub Desktop.
Save zanematthew/3001237 to your computer and use it in GitHub Desktop.
Separating logic
// Snippet from events/index.html.php
<!-- Track -->
<div class="row">
<h2 class="title"><?= $events->getTrackTitle( $post->ID ); ?></h2>
<div class="image-container">
<img src="<?= $tracks->getMapImage( $events->getTrackId( $post->ID ), 'medium' ); ?>" />
</div>
</div>
<!-- -->
<?php
// Snippet from events_controller.php
public function getTrackTitle( $event_id=null ){
$track_id = get_post_meta( $event_id, 'tracks_id', true );
$post = get_post( $track_id );
if ( $post )
return $post->post_title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment