Created
April 4, 2013 12:59
-
-
Save atinder/5310153 to your computer and use it in GitHub Desktop.
alveera shortcodes updated
This file contains 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 | |
if ( !function_exists('at_remove_autop') ) { | |
function at_remove_autop($content) { | |
$content = do_shortcode( shortcode_unautop($content) ); | |
$content = preg_replace( '#^<\/p>|^<br \/>|<p>$#', '', $content ); | |
return $content; | |
} | |
} | |
add_shortcode('subhead', 'at_subhead'); | |
function at_subhead($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$output = '<div class="sub-head"><span>' . $content . '</span></div>'; | |
return $output; | |
} | |
add_shortcode('i_button', 'at_i_button'); | |
function at_i_button($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$output = '<a href="' . $atts['href'] . '" class="alv-btn scrolltoanchor">'; | |
if(isset($atts['src']) && $atts['src'] != ''){ | |
$output .= '<img src="' . $atts['src'] . '" alt="">'; | |
} | |
$output .= '<span>' . $content .'</span></a>'; | |
return $output; | |
} | |
add_shortcode('divider', 'at_divider'); | |
function at_divider($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$output = '<div class="span12"><div class="divider1"> </div></div><div class="clearfix"></div>'; | |
return $output; | |
} | |
add_shortcode('office_info', 'at_office_info'); | |
function at_office_info($atts) { | |
$teml_dir = get_template_directory_uri(); | |
$output = '<div class="office-info"><div class="icon-wrap">'; | |
$output .= '<img src="' . $teml_dir . '/images/home_icon.png" alt=""></div>'; | |
$output .= '<strong>' . __('Address','at') . '</strong><br>'; | |
$output .= $atts['address'] ; | |
$output .= '</div>'; | |
$output .= '<div class="office-info"><div class="icon-wrap">'; | |
$output .= '<img src="' . $teml_dir . '/images/contact_icon_small.png" alt="">'; | |
$output .= '</div><strong>' . __('Email','sip') . '</strong><br>'; | |
$output .= '<a href="mailto:' . $atts['email'] . '">' . $atts['email'] . '</a></div>'; | |
return $output; | |
} | |
add_shortcode('social', 'at_social'); | |
function at_social(){ | |
global $alveera_data; | |
$output = '<div class="bottom-social"><div class="social-icons"><ul>'; | |
if(isset($alveera_data['tw_link']) && $alveera_data['tw_link']!='') { | |
$output .= '<li><a class="twitter tipsy" href="' . $alveera_data['tw_link'] . '" original-title="Twitter">Twitter</a></li>'; | |
} | |
if(isset($alveera_data['fb_link']) && $alveera_data['fb_link']!='') { | |
$output .= '<li><a class="facebook tipsy" href="' . $alveera_data['fb_link'] . '" original-title="Facebook">Facebook</a></li>'; | |
} | |
if(isset($alveera_data['gp_link']) && $alveera_data['gp_link']!='') { | |
$output .= '<li><a class="gplus tipsy" href="' . $alveera_data['gp_link'] . '" original-title="Google plus">Google plus</a></li>'; | |
} | |
if(isset($alveera_data['db_link']) && $alveera_data['db_link']!='') { | |
$output .= '<li><a class="dribble tipsy" href="' . $alveera_data['db_link'] . '" original-title="Dribble">Dribble</a></li>'; | |
} | |
if(isset($alveera_data['pt_link']) && $alveera_data['pt_link']!='') { | |
$output .= '<li><a original-title="Pinterest" class="pinterest tipsy" href="' . $alveera_data['pt_link'] . '">Pinterest</a></li>'; | |
} | |
if(isset($alveera_data['fr_link']) && $alveera_data['fr_link']!='') { | |
$output .= '<li><a title="Forrst" class="forrst tipsy" href="' . $alveera_data['fr_link'] . '">Forrst</a></li>'; | |
} | |
$output .= '</ul></div></div>'; | |
return $output; | |
} | |
add_shortcode('sponsor', 'at_sponsor'); | |
function at_sponsor($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$src = isset($atts['src']) ? $atts['src'] : ''; | |
$output = '<div class="client-box"><img alt="" src="' . $src . '"></div>'; | |
return $output; | |
} | |
add_shortcode("googlemap", "at_googleMaps"); | |
function at_googleMaps($atts, $content = null) { | |
extract(shortcode_atts(array( | |
"width" => '100%', | |
"height" => '310', | |
"src" => '' | |
), $atts)); | |
return '<div class="port-outer"><iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'&output=embed"></iframe></div><div> </div>'; | |
} | |
add_shortcode('portfolio', 'at_portfolio'); | |
function at_portfolio($atts, $content = null) { | |
$count = isset($atts['count']) ? $atts['count'] : ''; | |
$output = '<div class="row">'; | |
$output .= '<div id="portolfio-filter" class="span12"><ul>'; | |
$categories = get_terms('categoryportfolio'); | |
$output .= '<li><a data-filter="*" href="#" class="active">All</a></li>'; | |
if(count($categories) > 0 ){ | |
foreach ($categories as $category) { | |
$output .= '<li><a data-filter=".' . strtolower(str_replace(' ', '-', $category->name)) . '" href="#">' . $category->name . '</a></li>'; | |
} | |
} | |
$output .= '</ul></div><div class="clearfix"></div>'; | |
$output .= '<div id="content">'; | |
$loop = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => $count ) ); | |
global $post; | |
if ( $loop->have_posts() ): while ( $loop->have_posts() ) : $loop->the_post(); | |
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large'); | |
$terms = get_the_terms( $post->ID, 'categoryportfolio' ); | |
$classes = ''; | |
foreach ($terms as $term) { | |
$classes .= strtolower(str_replace(' ', '-',$term->name)) . ' '; | |
} | |
$output .= '<div class="' . $classes .'">'; | |
$output .= '<div class="span3"><div class="gallery-small"><div class="gallery-outer"><div class="mosaic-block circle">'; | |
$output .= '<a rel="prettyPhoto[portfolio]" class="mosaic-overlay" href="' . $large_image_url[0] . '"> </a>'; | |
$output .= '<div class="mosaic-backdrop">' . get_the_post_thumbnail( $post->ID ,'portfolio-thumb', array( 'class'=>'max-image' ) ) .'</div></div>'; | |
$output .= '<h3>' . get_the_title() . '</h3></div></div></div></div>'; | |
endwhile; endif; wp_reset_query(); | |
$output .= '</div></div><div class="clearfix"></div>'; | |
return $output; | |
} | |
add_shortcode('featured_portfolio', 'at_featured_portfolio'); | |
function at_featured_portfolio($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$count = isset($atts['count']) ? $atts['count'] : '1'; | |
$loop = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => $count ) ); | |
$output = '<div class="row">'; | |
if ( $loop->have_posts() ): while ( $loop->have_posts() ) : $loop->the_post(); | |
global $post; | |
$output .= '<div class="span8">'; | |
$custom = get_post_custom( $post->ID ); | |
if(isset($custom['gallery']['0']) && $custom['gallery']['0'] != ''){ | |
$output .= '<div class="outer-big portfolio-img-wrapper"><div class="port-outer"><div class="callbacks_container">'; | |
$output .= do_shortcode($custom['gallery']['0']); | |
$output .= '</div></div></div>'; | |
} | |
elseif(has_post_thumbnail( $post->ID )){ | |
$output .= '<div class="outer-big"><div class="port-outer"><div class="callbacks_container">'; | |
$output .= get_the_post_thumbnail( $post->ID, 'large' ); | |
$output .= '</div></div></div>'; | |
} | |
// $output .= preg_replace('/\<br[^\>]*\>/','',$gallery); | |
$output .= '</div>'; | |
$output .= '<div class="span4">'; | |
$output .= '<h3>' . get_the_title() . '</h3>'; | |
$output .= get_the_content() ; | |
$output .= '<h3 class="proj-det">' . __('Project Details','at'). '</h3>'; | |
$output .= '<ul class="details-list">'; | |
$terms = get_the_terms( $post->ID, 'categoryportfolio' ); | |
foreach ($terms as $term) { | |
$output .= '<li>' . $term->name . '</li>'; | |
} | |
$output .= '</ul><div class="clearfix"> </div>'; | |
$output .= '<p><a href="' . $custom['visit']['0'] . '" class="view-project">' . __('View Site','sip') . '</a></p></div>'; | |
$output .= '<div class="span12"><div class="divider1"> </div></div>'; | |
endwhile; endif; wp_reset_query(); | |
$output .= '</div>'; | |
return $output; | |
} | |
add_shortcode('skills', 'at_skills'); | |
function at_skills($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$count = isset($atts['count']) ? $atts['count'] : '10'; | |
$output = '<ul id="services-graph">'; | |
$loop = new WP_Query( array( 'post_type' => 'skills', 'posts_per_page' => $count ) ); | |
if ( $loop->have_posts() ): while ( $loop->have_posts() ) : $loop->the_post(); | |
global $post; | |
$custom = get_post_custom( $post->ID ); | |
$output .= '<li><span title="' . $custom['percentage']['0'] .'"></span><p>' . get_the_title() . ' <strong>' . $custom['percentage']['0'] . '%</strong></p></li>'; | |
endwhile; endif; wp_reset_query(); | |
$output .= '</ul>'; | |
return $output; | |
} | |
add_shortcode('testimonials', 'at_testimonials'); | |
function at_testimonials($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$count = isset($atts['count']) ? $atts['count'] : '3'; | |
$output = ''; | |
$loop = new WP_Query( array( 'post_type' => 'testimonials', 'posts_per_page' => $count ) ); | |
$output .= '<div class="testimonials-outer"><ul class="rslides" id="slider2">'; | |
if ( $loop->have_posts() ): while ( $loop->have_posts() ) : $loop->the_post(); | |
global $post; | |
$custom = get_post_custom( $post->ID ); | |
$output .= '<li><blockquote><span class="dropcaps">"</span><div><p>'; | |
$output .= $custom['testimonial']['0'] . '</p><div class="author-name">'; | |
$output .= $custom['client']['0'] . '<span>' . $custom['company']['0'] . '</span></div></div></blockquote></li>'; | |
endwhile; endif; wp_reset_query(); | |
$output .= '</div>'; | |
return $output; | |
} | |
add_shortcode('services', 'at_services_shortcode'); | |
function at_services_shortcode($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$count = isset($atts['count']) ? $atts['count'] : '3'; | |
$span = isset($atts['span']) ? $atts['span'] : 'span4'; | |
$loop = new WP_Query( array( 'post_type' => 'services', 'posts_per_page' => $count ) ); | |
$output = '<div class="row">'; | |
if ( $loop->have_posts() ): while ( $loop->have_posts() ) : $loop->the_post(); | |
global $post; | |
$custom = get_post_custom( $post->ID ); | |
$output .= '<div class="' . $span . '"><div class="team-wrap"><div class="team-img"><p>'; | |
$output .= get_the_post_thumbnail( $post->ID ,'team-icon', array( 'class'=>'' ) ); | |
$output .= '</p>'; | |
$output .= '</div><div class="team-txt">'; | |
$output .= '<h3 class="font24"><span>'. get_the_title() . '</span></h3>'; | |
$output .= get_the_content(); | |
$output .= '</div></div></div>'; | |
endwhile; endif; wp_reset_query(); | |
$output .= '</div>'; | |
return $output; | |
} | |
add_shortcode('team', 'at_team_shortcode'); | |
function at_team_shortcode($atts, $content = null) { | |
$content = at_remove_autop($content); | |
$count = isset($atts['count']) ? $atts['count'] : '3'; | |
$span = isset($atts['span']) ? $atts['span'] : 'span4'; | |
$loop = new WP_Query( array( 'post_type' => 'team', 'posts_per_page' => $count ) ); | |
$output = '<div class="row">'; | |
if ( $loop->have_posts() ): while ( $loop->have_posts() ) : $loop->the_post(); | |
global $post; | |
$custom = get_post_custom( $post->ID ); | |
$output .= '<div class="' . $span . '"><div class="team-wrap"><div class="team-img"><p>'; | |
$output .= get_the_post_thumbnail( $post->ID ,'team-icon', array( 'class'=>'' ) ); | |
$output .= '</p><div class="social-icons"><ul>'; | |
if(isset($custom['twitter']['0']) && $custom['twitter']['0'] != '') { | |
$output .= '<li><a href="' . $custom['twitter']['0'] . '" class="twitter tipsy" title="Twitter">Twitter</a></li>'; | |
} | |
if(isset($custom['facebook']['0']) && $custom['facebook']['0'] != '') { | |
$output .= '<li><a href="' . $custom['facebook']['0'] . '" class="facebook tipsy" title="Facebook">Facebook</a></li>'; | |
} | |
if(isset($custom['googleplus']['0']) && $custom['googleplus']['0'] != '') { | |
$output .= '<li><a href="' . $custom['googleplus']['0'] . '" class="gplus tipsy" title="Google plus">Google plus</a></li>'; | |
} | |
if(isset($custom['dribbble']['0']) && $custom['dribbble']['0'] != '') { | |
$output .= '<li><a href="' . $custom['dribbble']['0'] . '" class="dribble tipsy" title="Dribbble">Dribbble</a></li>'; | |
} | |
if(isset($custom['pinterest']['0']) && $custom['pinterest']['0'] != '') { | |
$output .= '<li><a href="' . $custom['pinterest']['0'] .'" class="pinterest tipsy" title="Pinterest">Pinterest</a></li>'; | |
} | |
if(isset($custom['forrst']['0']) && $custom['forrst']['0'] != '') { | |
$output .= '<li><a href="' . $custom['forrst']['0'] . '" class="forrst tipsy" title="Forrst">Forrst</a></li>'; | |
} | |
$output .= '</ul>'; | |
$output .= '</div></div><div class="team-txt">'; | |
$output .= '<h3 class="font24"><span>'. get_the_title() . '</span></h3>'; | |
$output .= '<div class="team-content">' . get_the_content() . '</div>'; | |
$output .= '</div></div></div>'; | |
endwhile; endif; wp_reset_query(); | |
$output .= '</div>'; | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment