- Defer judgement
- Aim high
- Yes, and
- Focus
- Quantity over quality
- Make city government cool
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| <?php | |
| add_action( 'init', 'register_fusion_content_ui' ); | |
| function register_fusion_content_ui() { | |
| shortcode_ui_register_for_shortcode( | |
| 'fusion-content', | |
| array( | |
| 'label' => 'Content', |
| <?php | |
| add_action( 'init', 'register_fusion_pullquote_ui' ); | |
| function register_fusion_pullquote_ui() { | |
| shortcode_ui_register_for_shortcode( | |
| 'fusion-pullquote', | |
| array( | |
| 'label' => 'Pullquote', | |
| 'listItemImage' => 'dashicons-editor-quote', |
| <?php | |
| class Publishing_Checklist { | |
| private static $instance; | |
| public static function get_instance() { | |
| if ( ! isset( self::$instance ) ) { | |
| self::$instance = new Publishing_Checklist; | |
| self::$instance->setup_actions(); | |
| } |
| <?php | |
| add_action( 'publishing_checklist_init', function() { | |
| $args = array( | |
| 'label' => esc_html__( 'Featured Image', 'demo_publishing_checklist' ), | |
| 'callback' => function ( $post_id, $id ) { | |
| return has_post_thumbnail( $post_id ); | |
| }, | |
| 'explanation' => esc_html__( 'A featured image is required.', 'demo_publishing_checklist' ), | |
| 'post_type' => array( 'post' ), |
| <?php | |
| register_speed_bump( 'rickroll', array( | |
| 'string_to_inject' => function() { return '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'; }, | |
| 'minimum_content_length' => false, | |
| 'from_start' => false, | |
| 'from_end' => false, | |
| )); | |
| add_filter( 'the_content', 'insert_speed_bumps', 1 ); |
| <?php | |
| register_speed_bump( 'rickroll', array( | |
| 'string_to_inject' => function() { return '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'; }, | |
| 'minimum_content_length' => false, | |
| 'from_start' => false, | |
| 'from_end' => false, | |
| )); | |
| add_filter( 'the_content', 'insert_speed_bumps', 1 ); |
| <?php | |
| add_filter( 'speed_bumps_rickroll_constraints', 'give_you_up', 10, 4 ); | |
| function give_you_up( $can_insert, $context, $args, $already_inserted ) { | |
| if ( ! preg_match( '/give [^ ]+ up/i', $context['prev_paragraph'] ) ) { | |
| $can_insert = false; | |
| } | |
| return $can_insert; | |
| } |
| <?php | |
| if ( current_user_can( 'manage_options' ) ) { | |
| add_filter( 'speed_bumps_rickroll_constraints', '__return_false' ); | |
| } |