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' => '>=' | |
) |
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(‘field_name’) || get_field(‘field_name_two’) ): ?> |
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
<div class="class_name" > | |
<ul><?php foreach(get_field('field_name') as $something) { | |
echo ‘<li>’.$something.’</li>’; | |
} ?></ul><? endif; ?> | |
</div> |
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 | |
/* | |
* Displaying single value | |
*/ | |
?> | |
<p>Posted on: <?php the_field('date_picker'); ?></p> | |
<?php |
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( is_single( 'field_name1' ) ): ?> | |
//do something | |
<?php elseif( is_single( 'fieldname2' ) ): ?> | |
//do something else | |
<?php elseif( is_single( '' ) ): ?> | |
//this is the default | |
<?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
<h1><?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?></h1> |
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
/** | |
* control editor role | |
*/ | |
$role = get_role('editor'); | |
$role->add_cap('edit_theme_options'); | |
function custom_admin_menu() { | |
$user = new WP_User(get_current_user_id()); |
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
add_filter('upload_mimes', 'custom_upload_mimes'); | |
function custom_upload_mimes ( $existing_mimes=array() ) { | |
// add your extension to the array | |
$existing_mimes['vcf'] = 'text/x-vcard'; | |
return $existing_mimes; | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>hide and show</title> | |
<style type="text/css"> | |
#mobile-only { | |
display:none; | |
} |
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
<span class="pp-data"> Category: </span> | |
<?php $terms = get_the_terms($post->ID, 'category-pp'); | |
$count = count($terms); | |
if ( $count > 0 ){ | |
foreach ( $terms as $term ) { | |
echo $term->name; | |
} | |
} | |
?> |