First, make sure you have Composer installed in your system.
In order to use the WPCS you'll need the PHP_CodeSniffer (PHPCS) and the WPCS rules (sniffs) installed.
You can install PHP_CodeSniffer globally using Composer by running this command:
| /* | |
| * Allow to set draft page as a parent page | |
| */ | |
| add_filter( 'page_attributes_dropdown_pages_args', 'enable_drafts_parents' ); | |
| add_filter( 'quick_edit_dropdown_pages_args', 'enable_drafts_parents' ); | |
| function enable_drafts_parents( $args ) { | |
| $args['post_status'] = 'draft,publish,pending'; | |
| return $args; | |
| } |
| #!/bin/bash | |
| # | |
| # Prints all hooks in a dir to a .log file. | |
| # | |
| # Permissions issues: | |
| # run: chmod +x gethooks | |
| # | |
| # gist: https://gist.github.com/ramiabraham/e8356e00130351ddcbe2c62125e6c52a | |
| # | |
| # Easy usage: |
First, make sure you have Composer installed in your system.
In order to use the WPCS you'll need the PHP_CodeSniffer (PHPCS) and the WPCS rules (sniffs) installed.
You can install PHP_CodeSniffer globally using Composer by running this command:
| <?php | |
| if ( ! function_exists( 'lets_clear_cache' ) ) { | |
| function lets_clear_cache() { | |
| // WP Rocket | |
| if ( function_exists( 'rocket_clean_domain' ) ) { | |
| rocket_clean_domain(); | |
| } | |
| // W3 Total Cache : w3tc |
| { | |
| // Place your snippets for php here. Each snippet is defined under a snippet name and has a prefix, body and | |
| // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
| // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
| // same ids are connected. | |
| // Example: | |
| // "Print to console": { | |
| // "prefix": "log", | |
| // "body": [ | |
| // "console.log('$1');", |
| <?php | |
| /* | |
| Plugin Name: Halloween Theme Switch Code | |
| Description: Switches the theme to a special Halloween theme only on October 31st. | |
| Author: Brad Williams | |
| Version: 1.0 | |
| Author URI: https://webdevstudios.com | |
| */ | |
| /** |