This file contains hidden or 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 wp_api_encode_acf($data,$post,$context){ | |
$data['meta'] = array_merge($data['meta'],get_fields($post['ID'])); | |
return $data; | |
} | |
if( function_exists('get_fields') ){ | |
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3); | |
} |
This file contains hidden or 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
//* Removes related videos from youtube | |
function remove_related_videos($embed) { | |
if (strstr($embed,'http://www.youtube.com/embed/')) { | |
return str_replace('?fs=1','?fs=1&rel=0',$embed); | |
} else { | |
return $embed; | |
} | |
} | |
add_filter('oembed_result', 'remove_related_videos', 1, true); |
This file contains hidden or 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 | |
/* Template Name: Test */ | |
/** | |
* Genesis custom loop | |
*/ | |
function be_custom_loop() { | |
global $post; | |
// arguments, adjust as needed |
This file contains hidden or 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
//* Return the department for a job posting based on url and place it in a gravity form hidden field | |
add_filter("gform_field_value_dept", "op_career_dept"); | |
function op_career_dept() { | |
//Get the referring URL | |
$posturl = $_SERVER['HTTP_REFERER']; | |
//Get the ID of the referring page | |
$postid = url_to_postid( $posturl ); | |
//Get the dept field based on the post ID | |
$dept = get_field('op_department', $postid); | |
return $dept; |
This file contains hidden or 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
//* Grab the referring page and place it in a gravity form hidden field. In this example the referring url is being placed in a hidden field called 'refurl' alter the filter target accordingly if a different field name is used | |
add_filter("gform_field_value_refurl", "referral_url"); | |
function referral_url( $form ) { | |
//Grab URL from HTTP Server Var and put it into a variable | |
$refurl = $_SERVER['HTTP_REFERER']; | |
//Return that value to the form | |
return esc_url_raw($refurl); | |
} |
This file contains hidden or 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
//* Return the slug of the parent page if there is one | |
function the_parent_slug() { | |
global $post; | |
if($post->post_parent == 0) return ''; | |
$post_data = get_post($post->post_parent); | |
return $post_data->post_name; | |
} |
This file contains hidden or 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
#bg-slider{ height: 450px; } |
This file contains hidden or 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 hidden or 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
echo "pm.max_children = $(( $(awk '/MemTotal:/ { printf "%d\n", ($2*0.80) }' /proc/meminfo) / $(ps --no-headers -o "rss,cmd" -C php5-fpm | awk '{ sum+=$1 } END { printf ("%d\n", sum/NR) }') ))" |
This file contains hidden or 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
#!/usr/bin/perl | |
# Modules | |
use utf8; | |
use XMLRPC::Lite; | |
use Data::Dumper; | |
$blogid = 1; | |
$username="username goes here"; | |
$password="password goes here"; |