DELETE FROM wp_posts WHERE post_status LIKE ‘flamingo_spam’ or to complete claer flamingo content DELETE FROM wp_posts WHERE post_type LIKE ‘%flamingo%’
For more code ideas go to my GitHub gists:
https://gist.github.com/johnnya23
Block Color Picker
Within the edit function of block.js
0 1 2 3 4 5 6 7 | var el = wp.element.createElement, Fragment = wp.element.Fragment, registerBlockType = wp.blocks.registerBlockType, InspectorControls = wp.editor.InspectorControls, RadioControl = wp.components.RadioControl, ColorPicker = wp.components.ColorPicker;//this this |
0 1 2 3 4 5 6 7 8 9 10 11 12 | el('div', {}, 'Menu Background'), el(ColorPicker, { type: 'color', color: menu_bg, onChangeComplete: function(newValue) { props.setAttributes({ menu_bg: newValue.hex }); }, disableAlpha: true }), |
Add Arguments to WordPress Hooks
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | function jma_gbs_template_redirect() { $body = true; add_action( 'genesis_before_sidebar_widget_area', function () use ($body) { jma_gbs_open_div($body); } ); add_action( 'genesis_before_loop', function () use ($body) { jma_gbs_open_div($body); } ); add_action( 'genesis_after_sidebar_widget_area', function () use ($body) { jma_gbs_close_div($body); } ); add_action( 'genesis_after_loop', function () use ($body) { jma_gbs_close_div($body); } ); } add_action('template_redirect', 'jma_gbs_template_redirect'); |
Debug
0 1 2 3 4 | define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); |
Custom Fontawesome Icons for Lists
Add to functions.php
0 1 2 3 4 5 6 | function jma_child_scripts() { wp_add_inline_script('fontawesome', 'window.FontAwesomeConfig={searchPseudoElements:true}', 'before'); } add_action('wp_enqueue_scripts', 'jma_child_scripts'); |
The Css:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* get rid of the bullets */ #content ul li { list-style-type: none; } /* suppress the default fontawesome behavior */ #content ul li::before { display: none; font-style: normal; font-variant: normal; text-rendering: auto; -webkit-font-smoothing: antialiased; } /* add your icon (right-angle here) */ #content ul li::before { font-family: "Font Awesome 5 Free"; font-weight: 900; content: '\f105'; } /* fontawesome hijacks the before pseudo element so we have to position w/ the class that they add */ #content ul li .svg-inline--fa { margin: 0 5px 0 -20px; } |
Uneven div Top
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .custom-top { /*margin-top: 50px;*/ background-image: url(back.jpg); background-size: cover; position: relative; background-position: 0 -50px !important; } .custom-top::before { content: ""; position: absolute; width: 100%; height: 50px; top: -49px; left: 0; -webkit-clip-path: polygon(0% 100%, 15% 41%, 28% 84%, 45% 21%, 63% 84%, 77% 10%, 84% 95%, 94% 56%, 100% 100%); clip-path: polygon(0% 100%, 15% 41%, 28% 84%, 45% 21%, 63% 84%, 77% 10%, 84% 95%, 94% 56%, 100% 100%); background-image: inherit; background-size: cover; /*background-position: 100px 5px;*/ } |
Add simple meta box(s)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | /* * When the post is saved, saves our custom data. * * @param int $post_id The ID of the post being saved. */ /* * Adds a box to the main column on the Post and Page edit screens. */ function jma_add_linkedin_input_box() { $screens = array('volunteer'); foreach ($screens as $screen) { add_meta_box( 'jma_linkedin_input_section', __('Linkedin address', 'jma_textdomain'), 'jma_linkedin_input_box', $screen, 'normal', 'high' ); } } add_action('add_meta_boxes', 'jma_add_linkedin_input_box'); /* * Prints the box content. * * @param WP_Post $post The object for the current post/page. */ function jma_linkedin_input_box($post) { // Add an nonce field so we can check for it later. wp_nonce_field('jma_linkedin_input_box', 'jma_linkedin_input_box_nonce'); /* * Use get_post_meta() to retrieve an existing value * from the database and use the value for the form. */ $linkedin_values = array(); if (get_post_meta($post->ID, '_jma_linkedin_data_key', true)) { $linkedin_values = get_post_meta($post->ID, '_jma_linkedin_data_key', true); } $linkedin_html = isset($linkedin_values['linkedin_text'])? $linkedin_values['linkedin_text']:''; echo '<p></p>'; echo '<label for="linkedin_text">'; _e('linkedin address.', 'jma_textdomain'); echo '</label><br/>'; echo '<input name="linkedin_text" size="80" type="text" value="'.$linkedin_html.'"/>'; } function jma_save_linkedin_postdata($post_id) { /* * We need to verify this came from the our screen and with proper authorization, * because save_post can be triggered at other times. */ // Check if our nonce is set. if (!isset($_POST['jma_linkedin_input_box_nonce'])) { return $post_id; } $nonce = $_POST['jma_linkedin_input_box_nonce']; // Verify that the nonce is valid. if (!wp_verify_nonce($nonce, 'jma_linkedin_input_box')) { return $post_id; } // If this is an autosave, our form has not been submitted, so we don't want to do anything. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } // Check the user's permissions. if ('page' === $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return $post_id; } } else { if (!current_user_can('edit_post', $post_id)) { return $post_id; } } /* OK, its safe for us to save the data now. */ // Sanitize user input. $jma_data['linkedin_text'] = sanitize_text_field($_POST['linkedin_text']); // Update the meta field in the database. update_post_meta($post_id, '_jma_linkedin_data_key', $jma_data); } add_action('save_post', 'jma_save_linkedin_postdata'); |
Google Maps Responsive Setup
Settings: Map Width 75% Directions “Yes, below” width 25%
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* maps */ .wpgmaps_directions_outer_div { padding-left: 5px; color: #ffffff } [id^=directions_panel], [id^=wpgmaps_directions] { background: #ffffff !important; clear: both } @media(min-width: 768px) { [id^=wpgmaps_directions] { float: left !important; clear: right !important; } } @media(max-width: 767px) { .wpgmza_map { width: 100% !important; } [id^=wpgmaps_directions] { width: 100% !important; } } |
Title Filtering
What ever you do is going to end up within the h1 tag, but this will keep it out of the menu etc.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | function personnel_filter($x) { $value = get_field('position'); $x = '<div class="person-sub">' . $value . '</div><!--person-sub-->' . $x; return $x; } function jma_person_title_cond($query) { global $wp_query; if ($query === $wp_query) { add_filter('the_title', 'personnel_filter', 10, 2); } else { remove_filter('the_title', 'personnel_filter', 10, 2); } } function jma_child_redirect() { if (is_singular('personnel') && get_field('position')) { add_action('loop_start', 'jma_person_title_cond'); } } add_action('template_redirect', 'jma_child_redirect'); |