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
var record = {}; | |
jQuery('.record').find('tr').each(function(idx, el) { | |
var row = jQuery(el); | |
var key = (row.find('td:first-child').hasClass('win') || row.find('td:first-child').hasClass('winTitle')) ? 'wins' : 'losses'; | |
var result = row.find('td').eq(5).text(); | |
var result_key = 'ko'; | |
if (idx > 0) { | |
if (result.indexOf('Decision') >= 0) { | |
result_key = 'decision'; |
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
var record = {}; | |
jQuery('.record').find('tr').each(function(idx, el) { | |
var row = jQuery(el); | |
var key = (row.find('td:first-child').hasClass('win') || row.find('td:first-child').hasClass('winTitle')) ? 'wins' : 'losses'; | |
var organization = row.find('td').eq(7).text(); | |
if (idx > 0) { | |
if (typeof record[organization] === 'undefined') { | |
record[organization] = { | |
wins: 0, |
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 | |
ini_set( 'memory_limit', '512M' ); | |
$_SERVER['REQUEST_METHOD'] = 'GET'; | |
$_SERVER['HTTP_HOST'] = 'siteurl.com'; | |
define( 'USE_THEMES', false ); | |
if ( file_exists( getenv( 'HOME' ) . '/public_html/wp-load.php' ) ) { | |
require_once getenv( 'HOME' ) . '/public_html/wp-load.php'; |
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 | |
function company_banner_to_og_image( $image ) { | |
global $post; | |
if ( is_singular( 'company' ) ) { | |
$image_sizes = get_field( 'banner', $post->ID ); | |
$image = $image_sizes['sizes']['large']; | |
} |
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 | |
function acf_load_color_scheme_field_options( $field ) { | |
$field['choices'] = array(); | |
$options = fetch_my_choises(); // Fetch your choises from somewhere | |
if ( is_array( $options ) ) { | |
foreach ( $options as $option ) { | |
$field['choices'][ $option ] = $option; |
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 | |
function my_theme_widget_tag_cloud_args( $args ) { | |
$args['largest'] = 1; | |
$args['smallest'] = 1; | |
$args['unit'] = 'em'; | |
return $args; | |
} |
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 | |
$image_id = get_attachment_id_from_url( $image_url ); | |
$thumb = wp_get_attachment_image_src( $image_id, 'thumbnail' ); | |
echo $thumb[0]; |
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 | |
function get_attachment_id_from_url( $image_url ) { | |
global $wpdb; | |
$attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ) ); | |
return $attachment[0]; | |
} |
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 | |
function remove_comment_menu(){ | |
remove_menu_page( 'edit-comments.php' ); | |
} | |
add_action( 'admin_menu', 'remove_comment_menu' ); |
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 | |
function get_my_expensive_data() { | |
$cache_key = 'my-cache-key'; | |
$transient = get_transient( $cache_key ); | |
if ( $transient ) { | |
return $transient; | |
} else { | |
$data = wp_remote_get( 'http://your-service.com' ); |