Languages
7,683 gist results
7,683 gist results
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 | |
| class Animal{ | |
| protected $name; | |
| protected function __construct($name){ | |
| $this->name = $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
| <?php | |
| $foo = array(); | |
| $a = array(1,2,3); | |
| $b = array(4,5,6); | |
| $foo += $a; | |
| $foo += $b; | |
| print_r($foo); | |
| ?> | |
| // result |
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 get_custom_cat_template($single_template) { | |
| global $post; | |
| if ( in_category( 'category-name' )) { | |
| $single_template = dirname( __FILE__ ) . '/single-template.php'; | |
| } | |
| return $single_template; | |
| } | |
| add_filter( "single_template", "get_custom_cat_template" ) ; |
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 | |
| class Your_Plugin { | |
| /** | |
| * Post Type slug modification | |
| * | |
| * @since 1.0.0 | |
| * @return null | |
| */ | |
| function modifySlug($link, $post) | |
| { |
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 | |
| // Get a greeting based on the body | |
| $Body = $_GET['Body']; | |
| if(stripos($Body, "e4n3m23pd90vc4:9nfaDFADFD42baconP0o") !== FALSE){ | |
| $greeting = "<Command not recognized> "; | |
| } | |
| else if(stripos($Body, "stop") !== FALSE || strlen($Body)>30){ | |
| $greeting = "Hammer time. "; | |
| } |
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 | |
| class Cat extends Eloquent { | |
| protected $fillable = array('name','date_of_birth','breed_id'); | |
| public function breed(){ | |
| return $this->belongsTo('Breed'); | |
| } | |
| } |
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
| <? | |
| // Which category will be the blog page? | |
| $options[] = array( "name" => "Blog Category", | |
| "desc" => "Select the category that will be blog posts. All other categories will be in the portfolio format.", | |
| "id" => $shortname."_cats_in_blog", | |
| "std" => "", | |
| "type" => "select", | |
| "options" => $of_categories); |
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 | |
| /** | |
| * Gravity Perks // GP Copy Cat // Filter Copy Cat Fields | |
| * http://gravityperks.com/ | |
| */ | |
| add_filter( 'gpcc_copy_cat_fields_126', function( $fields, $form ) { | |
| $fields[44] = array( | |
| array( | |
| 'source' => 44, |
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 | |
| add_filter('geodir_create_marker_jason_of_posts','_my_change_cat_map_markers_to_current_cat',11,2); | |
| function _my_change_cat_map_markers_to_current_cat($marker_json,$post){ | |
| global $gd_cur_term_icon_url; | |
| if(geodir_is_page('listing') && is_tax()){ | |
| if(!$gd_cur_term_icon_url){ | |
| $term_icon_url = get_tax_meta(get_queried_object()->term_id, 'ct_cat_icon', false, $post->post_type); |
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 | |
| // Category array | |
| function chaoz_cat_array($term='portfolio_cat') { | |
| $cats = get_terms(array( | |
| 'taxonomy' => $term, | |
| 'hide_empty' => true | |
| )); | |
| $cat_array = array(); | |
| $cat_array['all'] = esc_html__('All', 'gullu'); | |
| foreach ($cats as $cat) { |