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(isset($_POST['submit'])) { | |
$fh = fopen($_FILES['file']['tmp_name'], 'r+'); | |
$lines = array(); | |
while( ($row = fgetcsv($fh, 8192)) !== FALSE ) { | |
$lines[] = $row; | |
} | |
var_dump($lines); | |
} | |
?> |
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 change_posts_per_page( $query ) { | |
if ( is_main_query() && is_archive() ) { | |
$query->set( 'posts_per_page', -1 ); | |
} | |
} | |
add_action( 'pre_get_posts', 'change_posts_per_page' ); |
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
function your_theme_exclude_pages_from_search( $query ) { | |
$query->set( 'post__not_in', PAGE_ID_HERE ); | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'your_theme_exclude_pages_from_search' ); |
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
$post_id = 1; //Post ID | |
$post_taxonomies = get_field('assigned-taxonomies', $post_id); | |
$args = array( | |
'post_type' => 'post', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'your-taxonomy', | |
'field' => 'term_id', | |
'terms' => $post_taxonomies |
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 | |
$location = get_field('your_location'); | |
if( !empty($location) ): | |
?> | |
<?php $location = explode( "," , $location['address']); | |
echo $location[0].', '; //street number | |
echo $location[1].','.$location[2]; //city, state + zip | |
// print_r($location); |
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 | |
/** | |
* | |
* Adds location rule to target specific sites in a WordPress Multisite environment | |
* http://www.advancedcustomfields.com/resources/custom-location-rules/ | |
* | |
*/ | |
function acf_location_rule_type_blog( $choices ) { |
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 | |
$pro_license = maybe_unserialize(base64_decode(get_option('acf_pro_license'))); | |
if (!$pro_license || $pro_license['url'] != home_url()) { | |
$save = array( | |
'key' => 'license_here', | |
'url' => home_url() | |
); | |
$save = maybe_serialize(base64_encode($save)); |
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 | |
add_action('gform_after_submission_14', 'reformat_multiselect', 10, 2); | |
function reformat_multiselect($entry, $form) { | |
$post_id = $entry['post_id']; | |
$selects = array( | |
'custom_field1' => 'ACF_field_key', | |
'custom_field2' => 'ACF_field_key', | |
'custom_field3' => 'ACF_field_key' |
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
// Front Raw | |
$gravity_form_id = 6; // gravity form id, or replace {$gravity_form_id} below with this number | |
add_filter("gform_after_submission_{$gravity_form_id}", 'eve_set_front_raw_image_field', 10, 2); | |
function eve_set_front_raw_image_field($entry, $form){ | |
$gf_images_field_id = 50; // the upload field id | |
$acf_field_id = 'field_54ca50b09afe2'; // the acf front raw field id | |
// get post | |
if (isset($entry['post_id'])) { | |
$post = get_post($entry['post_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
<?php | |
/* | |
Term Archive Pages: | |
- http://example.com/recipes/dinner/ | |
- http://example.com/recipes/breakfast,brunch/ | |
Single Recipe Pages: | |
- http://example.com/recipes/dinner/soup-title/ |