Created
April 13, 2012 03:23
-
-
Save abachuk/2373381 to your computer and use it in GitHub Desktop.
WP example 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Business Rankings | |
* @package WordPress | |
*/ | |
get_header(); | |
?> | |
<aside class="right-sidebar"> | |
<ul class="widgets"> | |
<?php dynamic_sidebar( 'business-widget-area' ); ?> | |
</ul> | |
</aside> | |
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> | |
<div class="container"> | |
<article id="post-<?php the_ID(); ?>" <?php post_class('last'); ?>> | |
<h1 class="article-title"><?php the_title(); ?></h1> | |
<div class="entry-content"> | |
<?php the_post_thumbnail(); ?> | |
<?php the_content(); ?> | |
<?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'boilerplate' ), 'after' => '' ) ); ?> | |
<?php edit_post_link( __( 'Edit', 'boilerplate' ), '', '' ); ?> | |
</div><!-- .entry-content --> | |
<?php endwhile; ?> | |
<ul class="top-5-recommended-businesss"> | |
<li> | |
<nav class="table-header"><ul> | |
<li class="rank-column">Top</li> | |
<li class="site-column"> </li> | |
<li class="business-column">business</li> | |
<li class="score-column">Score</li> | |
<li class="flag-column">FR</li> | |
<li class="bonus-column">Logiciel</li> | |
<li class="bonus-percent-column"></li> | |
<li class="jouer-column"></li> | |
</ul></nav><!-- table-header --> | |
<?php global $query_string; | |
$args = array( | |
'post_type' => 'business', | |
'paged' => get_query_var('paged'), | |
'posts_per_page' => 20, | |
'orderby' => 'menu_order', | |
'order'=> 'ASC' | |
); | |
query_posts($args); | |
while (have_posts()) : the_post(); | |
////// get custom metabox info | |
$business_rank = get_post_meta($post->ID, '_cmb_business_rank', true); | |
$business_logo = get_post_meta($post->ID, '_cmb_business_img', true); | |
$business_score = get_post_meta($post->ID, '_cmb_business_score', true); | |
$business_flag = get_post_meta($post->ID, '_cmb_business_flag', true); | |
$business_reviews = get_post_meta($post->ID, '_cmb_business_reviews', true); | |
$business_news = get_post_meta($post->ID, '_cmb_business_news', true); | |
$business_link = get_post_meta($post->ID, '_cmb_business_url', true); | |
$business_software = get_post_meta($post->ID, '_cmb_business_software', true); | |
$business_software_url = get_post_meta($post->ID, '_cmb_business_softwareurl', true); | |
?> | |
<ul class="table-rows"> | |
<li class="rank-column"><?php echo $business_rank; ?></li> | |
<li class="site-column"><img src="<?php echo $business_logo; ?>" alt="" /></li> | |
<li class="business-column"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> | |
<li class="score-column"> | |
<?php switch ($business_score) { | |
case "1": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star1.png" alt=""> | |
<?php break; | |
case "2": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star2.png" alt=""> | |
<?php break; | |
case "3": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star3.png" alt=""> | |
<?php break; | |
case "4": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star4.png" alt=""> | |
<?php break; | |
case "5": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star5.png" alt=""> | |
<?php break; | |
case "1.5": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star1half.png" alt=""> | |
<?php break; | |
case "2.5": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star2half.png" alt=""> | |
<?php break; | |
case "3.5": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star3half.png" alt=""> | |
<?php break; | |
case "4.5": ?> | |
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/star4half.png" alt=""> | |
<?php break; | |
} ?> | |
</li> | |
<li class="flag-column"><?php //print_r ($business_flag); ?> | |
<?php switch ($business_flag) { | |
case "yep": | |
echo do_shortcode('[geocode id=1]'); | |
break; | |
case "nope": | |
echo do_shortcode('[geocode id=4]'); | |
break; | |
default: | |
echo do_shortcode('[geocode id=1]'); | |
break; | |
} ?> | |
</li> | |
<li class="reviews-column"><a href="<?php echo $business_software_url; ?>"><?php echo $business_software; //the_terms($post->ID, 'business-software', '', '', ''); ?></a></li> | |
<li class="news-column"><a href="<?php echo $business_news; ?>">News</a></li> | |
<li class="jouer-column"><a class="button" href="<?php echo $business_link; ?>">Jouer</a></li> | |
</ul> | |
<?php endwhile; ?> | |
</li> | |
</ul> | |
<nav class="lower-nav"> | |
<ul> | |
<li class="prev-link"><?php previous_posts_link( __( '< 20 Previous', 'twentyten' ) ); ?></li> | |
<li class="next-link"><?php next_posts_link( __( 'Next 20 >', 'twentyten' ) ); ?></li> | |
</ul> | |
</nav><!-- lower-nav --> | |
</article><!-- two-thirds --> | |
</div><!-- .container --> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment