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
| // 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 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
| 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 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
| $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 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
| /* | |
| * 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 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 | |
| /** | |
| * 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 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 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 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
| 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 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
| /** | |
| * Automobile interface | |
| * | |
| * Creates a contract that any class implementing this interface must abide by | |
| */ | |
| interface Automobile { | |
| /** | |
| * steering_wheel function | |
| * | |
| * @access public |
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
| /** | |
| * Class CarA | |
| */ | |
| class CarA implements Automobile { | |
| protected $specs; | |
| /** | |
| * Constructor | |
| * | |
| * @param object $specs The object of data defining Car A |
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
| .box { | |
| width:200px; | |
| height:200px; | |
| background-color:#DC403B | |
| } |