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
acf.add_filter('validation_complete', function( json, $form ){ | |
// Return early if there are no errors. | |
// This will avoid the dreded "isArrayLike empty obj error" | |
// https://github.com/jquery/jquery/issues/2242 | |
if ( 0 === json.errors ) { | |
return json; | |
} | |
// show field error messages |
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 cg_revert_jquery_version_admin() { | |
wp_deregister_script( 'jquery' ); | |
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'); | |
wp_enqueue_script( 'jquery' ); | |
} | |
add_action( 'admin_enqueue_scripts', 'cg_revert_jquery_version_admin' ); |
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 | |
/** | |
* For developers: WordPress debugging mode. | |
* | |
* Change this to true to enable the display of notices during development. | |
* It is strongly recommended that plugin and theme developers use WP_DEBUG | |
* in their development environments. | |
* | |
* Add this above "That's all, stop editing! Happy blogging." | |
*/ |
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
/* | |
* jQuery FlexSlider v2.2.2 | |
* Copyright 2012 WooThemes | |
* Contributing Author: Tyler Smith | |
*/ | |
(function(e){e.flexslider=function(t,n){var r=e(t);r.vars=e.extend({},e.flexslider.defaults,n);var i=r.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,o=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&r.vars.touch,u="click touchend MSPointerUp keyup",a="",f,l=r.vars.direction==="vertical",c=r.vars.reverse,h=r.vars.itemWidth>0,p=r.vars.animation==="fade",d=r.vars.asNavFor!=="",v={},m=true;e.data(t,"flexslider",r);v={init:function(){r.animating=false;r.currentSlide=parseInt(r.vars.startAt?r.vars.startAt:0,10);if(isNaN(r.currentSlide))r.currentSlide=0;r.animatingTo=r.currentSlide;r.atEnd=r.currentSlide===0||r.currentSlide===r.last;r.containerSelector=r.vars.selector.substr(0,r.vars.selector.search(" "));r.slides=e(r.vars.selector,r);r.container=e(r.containerSelector,r);r.count=r.slides.length;r.syncExists=e(r.vars.sync).length>0;if(r.vars |
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
$list_of_ids = '1,2,3,4,5,6'; | |
if ( cg_validate_int( $list_of_ids ) ) { | |
echo 'Huzzah! We have valide integers!'; | |
} | |
/** | |
* Allows us to pass either an array of or a single intger and validate that they are integers | |
* | |
* @param int|string $list_of_ids Pass either a single integer or a comma separated list | |
* |
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
class My_Awesome_Plugin { | |
public function __construct() { | |
add_action( 'init', array( $this, 'setup_textdomain' ) ); | |
} | |
public static function setup_textdomain() { | |
$locale = apply_filters( 'plugin_locale', get_locale(), $this->domain ); | |
load_textdomain( $this->domain, WP_LANG_DIR . '/plugin-name/plugin-name-' . $locale . '.mo' ); | |
load_plugin_textdomain( $this->domain, false, $this->plugin_dir . '/languages/' ); | |
} | |
} |
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 to functions.php and namespace your methods! :) | |
function cg_rss_post_thumbnail( $content ) { | |
global $post; | |
if ( has_post_thumbnail( absint( $post->ID ) ) ) { | |
$content = '<p>' . get_the_post_thumbnail( asbint( $post->ID ) ) . '</p>' . get_the_content(); | |
} | |
return $content; | |
} |
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
/** | |
* Register our sidebars and widgetized areas. | |
* Add this block to your functions.php | |
* | |
*/ | |
function arphabet_widgets_init() { | |
register_sidebar( array( | |
'name' => 'Home right sidebar', | |
'id' => 'home_right_1', // Take note of the ID! We'll need this to call the right widgetized area in our theme |
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 | |
// The query variable | |
$queried_term = get_query_var( 'Clients' ); | |
// Return the terms for current post based off the query variable. Make you sanitize your queries!! | |
$terms = wp_get_post_terms( absint( get_the_ID() ), 'Clients', array( 'fields' => 'all' ) ); | |
// Start the arguments for WP_Query(). We'll define an empty tax_query | |
// so we hav something to dump our terms into programatically. | |
$args = array( |
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 id="content"> | |
<?php | |
$args = array( | |
'post_type' => 'recipes', | |
'paged' => ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 ), | |
); | |
// It's generally a good idea to give a unique name for your new query, so I'll name this $recipes | |
$recipes = new WP_Query( $args ); | |
?> |