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 | |
/** | |
* MIT License | |
* =========== | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files (the | |
* "Software"), to deal in the Software without restriction, including | |
* without limitation the rights to use, copy, modify, merge, publish, | |
* distribute, sublicense, and/or sell copies of the Software, and to |
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 (has_post_thumbnail( $project->ID )) : ?> | |
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $project->ID ), 'single-post-thumbnail' ); ?> | |
<img src="<?php echo $image[0]; ?>" alt="" /> | |
<?php endif; ?> |
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 | |
function brrad_geocode($street_address,$city,$state){ | |
$street_address = str_replace(" ", "+", $street_address); //google doesn't like spaces in urls, but who does? | |
$city = str_replace(" ", "+", $city); | |
$state = str_replace(" ", "+", $state); | |
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$street_address,+$city,+$state&sensor=false"; | |
$google_api_response = wp_remote_get( $url ); | |
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
//Edit the Category List | |
add_filter( 'manage_edit-post_type_columns', 'set_custom_edit_post_type_columns' ); | |
// Add to admin_init function | |
add_filter( 'manage_post_type_custom_column', 'manage_post_type_columns', 10, 3); | |
function manage_post_type_columns($out, $column_name, $id) { | |
switch ($column_name) { | |
case 'icon_image': | |
// Output custom post_type field here |
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(have_rows('repeater_field_name')): ?> | |
<ul> | |
<?php while( have_rows('repeater_field_name')): the_row(); ?> | |
<li><?php echo get_sub_field('image'); ?></li> | |
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?> | |
<?php endwhile; ?> | |
</ul> | |
<?php endif; ?> |
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
//For blank searches to use search.php | |
add_filter( 'request', 'my_request_filter' ); | |
function my_request_filter( $query_vars ) { | |
if( isset( $_GET['s'] ) && empty( $_GET['s'] ) ) { | |
$query_vars['s'] = " "; | |
} | |
return $query_vars; | |
} |
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
/** | |
* Child page conditional | |
* @ Accept's page ID, page slug or page title as parameters | |
*/ | |
function is_child( $parent = '' ) { | |
global $post; | |
$parent_obj = get_page( $post->post_parent, ARRAY_A ); | |
$parent = (string) $parent; | |
$parent_array = (array) $parent; |
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
$categories = get_the_terms( get_the_id() , 'service' ); | |
$separator = '<br />'; | |
$output = ''; | |
if($categories){ | |
foreach($categories as $category) { | |
//$output .= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator; | |
$output .= $category->name . $separator; | |
} | |
echo trim($output, $separator); | |
} |
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 | |
$images = get_field('gallery'); | |
if( $images ): ?> | |
<div id="slider" class="flexslider"> | |
<ul class="slides"> | |
<?php foreach( $images as $image ): ?> | |
<li> | |
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> | |
<p><?php echo $image['caption']; ?></p> |
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 | |
$images = get_field('floorplans'); | |
if( $images ): ?> | |
<div id="slider" class="flexslider"> | |
<div class="col-md-3"> | |
<?php foreach( $images as $image ): ?> | |
<a href="<?php echo $image['url']; ?>" data-lightbox="floorplans"><img src="<?php echo $image['sizes']['medium']; ?>" alt="<?php echo $image['alt']; ?>" /></a> | |
<?php endforeach; ?> | |
</div> |
OlderNewer