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(get_field('slider')): ?> | |
<script> | |
jQuery(window).load(function($) { | |
$('.flexslider').flexslider({ | |
animation: "slide" | |
}); | |
}); |
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
//////// PLACEHOLDER TEXT ////////////// | |
/* Add a custom field to the field editor (See editor screenshot) */ | |
add_action("gform_field_standard_settings", "my_standard_settings", 10, 2); | |
function my_standard_settings($position, $form_id){ | |
// Create settings on position 25 (right after Field Label) | |
if($position == 25){ |
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 | |
$terms = get_terms('taxonomy'); | |
$count = count($terms); | |
//check if there are any terms | |
if ( $count > 0 ){ | |
//loop through each term and query posts. | |
foreach($terms as $term){ | |
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 $image = wp_get_attachment_image_src(get_field('image'), 'medium'); ?> | |
<img src="<?php echo $image[0]; ?>"> |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
$post_categories = wp_get_post_categories( $post->ID ); | |
// get first category id | |
$first_cat = get_category($post_categories[0]); | |
// get category term info. | |
$term_link = get_term_link( $first_cat->slug, $first_cat->taxonomy ); | |
// do what you want with it. | |
echo "<a href='".$term_link."'>".$first_cat->name."</a>"; | |
?> |
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( current_user_can('edit_others_pages') ) { | |
// do something | |
} | |
?> |
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 upload_external_image( $post_id, $img_url ) { | |
// load media handlers | |
require_once( ABSPATH . 'wp-admin' . '/includes/image.php' ); | |
require_once( ABSPATH . 'wp-admin' . '/includes/file.php' ); | |
require_once( ABSPATH . 'wp-admin' . '/includes/media.php' ); | |
// create a temp file | |
$temp_file = download_url( $img_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
<?php | |
$current_date = date(Ymd); | |
$event_args = array( | |
'post_type' => 'event_post_type', | |
'meta_query' => array( | |
array( | |
'key' => 'date_field', | |
'value' => $current_date, | |
'compare' => '>=' | |
) |