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 My_Class { | |
| public function my_func() { | |
| // We can error log our data here. | |
| error_log( __LINE__ ); // outputs 6 | |
| // Or we can also log which method we're in | |
| error_log( __METHOD__ ); // outputs My_Class::my_func | |
| } | 
  
    
      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 | |
| /** | |
| * Display Custom Roles in WordPress Admin | |
| */ | |
| add_action('manage_users_custom_column', 'yanco_show_user_roles_column_content', 10, 3); | |
| function yanco_show_user_roles_column_content($value, $column_name, $user_id) { | |
| global $wp_roles; | |
| $user = get_userdata( $user_id ); | 
  
    
      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
    
  
  
    
  | // Post thumbnails support | |
| add_theme_support('post-thumbnails'); | |
| // Menu support | |
| add_theme_support('menus'); | |
| <?php | |
| // Post editor styling | |
| add_theme_support('editor-style'); | |
| // Post formats support | 
  
    
      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 | |
| /* | |
| * Dependent Plugin Activation/Deactivation | |
| * | |
| * Sources: | |
| * 1. https://pippinsplugins.com/checking-dependent-plugin-active/ | |
| * 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/ | |
| * | |
| */ | |
  
    
      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_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 ); | |
| function woocommerce_category_image() { | |
| if ( is_product_category() ){ | |
| global $wp_query; | |
| $cat = $wp_query->get_queried_object(); | |
| $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
| $image = wp_get_attachment_url( $thumbnail_id ); | |
| if ( $image ) { | |
| echo '<img src="' . $image . '" alt="" />'; | 
  
    
      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 Functions { | |
| private $theme_name; | |
| private $theme_version; | |
| public function __construct( $theme_name, $theme_version ) { | |
| $this->theme_name = $theme_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
    
  
  
    
  | /** | |
| * Allow HTML in Widget Titles | |
| */ | |
| function html_widget_title( $title ) { | |
| //HTML tag opening/closing brackets | |
| $title = str_replace( '[', '<', $title ); | |
| $title = str_replace( '[/', '</', $title ); | |
| // bold -- changed from 's' to 'strong' because of strikethrough code | |
| $title = str_replace( 'strong]', 'strong>', $title ); | |
| $title = str_replace( 'b]', 'b>', $title ); | 
  
    
      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 | |
| /** | |
| * Loop Add to Cart | |
| * | |
| * This template can be overridden by copying it to yourtheme/woocommerce/loop/add-to-cart.php. | |
| * | |
| * HOWEVER, on occasion WooCommerce will need to update template files and you | |
| * (the theme developer) will need to copy the new files to your theme to | |
| * maintain compatibility. We try to do this as little as possible, but it does | |
| * happen. When this occurs the version of the template file will be bumped and | 
  
    
      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
    
  
  
    
  | // This is the initial GravityForms binding, it will be lost upon a page change with next/previous | |
| // Thus we make a bind on gform_page_loaded event also | |
| if( jQuery('.custom-form').length > 0 ) { | |
| jQuery('.gfield_radio input[type=radio]').bind("click", function() { | |
| //console.log('Clicked: ' + jQuery( this ).closest('.gform_page').find('.gform_page_footer .gform_next_button.button') ); | |
| jQuery(this).closest('.gform_page').find('.gform_page_footer .gform_next_button.button').click(); | |
| }); | |
| } | |
| jQuery(document).bind('gform_page_loaded', function(event, form_id, current_page){ | 
  
    
      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 | |
| //$file = '/path/to/file.png'; | |
| $file = rtrim(ABSPATH, '/').parse_url( 'http://url-to-file/file.png' , PHP_URL_PATH); | |
| $filename = basename($file); | |
| $upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
| if (!$upload_file['error']) { | |
| $wp_filetype = wp_check_filetype($filename, null ); | |
| $attachment = array( | |
| 'post_mime_type' => $wp_filetype['type'], |