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 | |
| /** | |
| * Attempts to retrieve the WP timezone, or if not set, the timezone derived from the gmt_offset. | |
| * | |
| * @access private | |
| * @since 2.2 | |
| * | |
| * @return string Timezone string, or if all checks fail, default is 'UTC'. | |
| */ | |
| private function get_core_timezone() { |
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> | |
| /** | |
| * Checks if all first-level items in the array are of the given type. | |
| * | |
| * Example: | |
| * | |
| * function test_get_posts_with_no_fields_arg_should_return_array_of_WP_Post_objects() { | |
| * $this-assertContainsOnlyType( 'WP_Post', get_posts() ); | |
| * } | |
| * |
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 | |
| /** | |
| * Plugin Name: AffiliateWP - WooCommerce Product Categories Fix | |
| * Plugin URI: https://affiliatewp.com | |
| * Description: Fixes product category 404s when used in conjunction with pretty affiliate URLs. | |
| * Author: AffiliateWP, LLC | |
| * Author URI: https://affiliatewp.com | |
| * Version: 1.0 | |
| * | |
| * AffiliateWP Debug is distributed under the terms of the GNU General Public License as published by |
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_filter( 'rewrite_rules_array', function( $rules ) { | |
| if ( ! function_exists( 'WC' ) || ! function_exists( 'affiliate_wp' ) ) { | |
| return $rules; | |
| } | |
| if ( true === version_compare( WC()->version, '3.0.0', '>=' ) ) { | |
| $permalinks = wc_get_permalink_structure(); | |
| } else { | |
| $permalinks = get_option( 'woocommerce_permalinks' ); |
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 Beer { | |
| const NAME = 'Beer!'; | |
| public static function printed(){ | |
| echo 'static Beer:NAME = '. static::NAME . '<br />'; | |
| } | |
| } | |
| class Ale extends Beer { |
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 | |
| /** | |
| * Adds 'Affiliates' Toolbar links in the My Sites drop-down. | |
| * | |
| * @param WP_Admin_Bar $wp_admin_bar Toolbar instance. | |
| */ | |
| function affiliate_toolbar_links( $wp_admin_bar ) { | |
| foreach ( $wp_admin_bar->user->blogs as $blog ) { | |
| $blog_id = $blog->userblog_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
| <?php | |
| require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' ); | |
| $this->wp_customize->widgets = new WP_Customize_Widgets( $this->wp_customize ); | |
| require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' ); | |
| $this->wp_customize->nav_menus = new WP_Customize_Nav_Menus( $this->wp_customize ); | |
| // Restore setup for nav menus (normally hooked at priority 11). | |
| add_action( 'customize_register', array( $this->wp_customize->nav_menus, 'customize_register' ), 501 ); |
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
| mysql -u wp -p wp -e "drop database wptests; create database wptests;" |
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 | |
| /* | |
| * If hierarchical is false, and child_of is not empty, pages will (apparently) be returned | |
| * hierarchically anyway in order of creation: 3, 4, 5. | |
| */ | |
| $this->assertEqualSets( array( $page_3, $page_4, $page_5 ), wp_list_pluck( $pages, 'ID' ) ); | |
| // How it should work. | |
| $found_pages = wp_list_filter( $pages, array( 'post_parent' => $page_1 ) ); | |
| $this->assertEqualSets( array( $page_3, $page_5 ), wp_list_pluck( $found_pages, '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
| wp_nav_menu( apply_filters( 'widget_nav_menu_args', $nav_menu_args, $nav_menu, $args, $instance, $this ) ); | |
| // $nav_menu_args | |
| Array | |
| ( | |
| [fallback_cb] => | |
| [menu] => stdClass Object | |
| ( | |
| [term_id] => 176 | |
| [name] => Short |