From 2eaa40b92caf493044b4685e92aff3d496d18ac6 Mon Sep 17 00:00:00 2001 From: dlousa92 Date: Tue, 9 Apr 2019 13:24:23 -0400 Subject: [PATCH 1/6] remove filter on the content --- wp-content/themes/aerospace/inc/template-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-content/themes/aerospace/inc/template-functions.php b/wp-content/themes/aerospace/inc/template-functions.php index 1b70afde..cc202600 100755 --- a/wp-content/themes/aerospace/inc/template-functions.php +++ b/wp-content/themes/aerospace/inc/template-functions.php @@ -150,7 +150,7 @@ function aerospace_add_logo_to_post_content( $content ) { } return $content; } -add_filter('the_content', 'aerospace_add_logo_to_post_content', 0); +// add_filter('the_content', 'aerospace_add_logo_to_post_content', 0); /** * Fixes empty

and
tags showing before and after shortcodes in the From 5494d1d397f368427d119c96e023523f8f273012 Mon Sep 17 00:00:00 2001 From: dlousa92 Date: Fri, 12 Apr 2019 10:00:00 -0400 Subject: [PATCH 2/6] remove from custom post meta --- wp-content/themes/aerospace/inc/custom-post-meta.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/wp-content/themes/aerospace/inc/custom-post-meta.php b/wp-content/themes/aerospace/inc/custom-post-meta.php index 5fcb6eed..efb5a536 100644 --- a/wp-content/themes/aerospace/inc/custom-post-meta.php +++ b/wp-content/themes/aerospace/inc/custom-post-meta.php @@ -36,7 +36,6 @@ function post_build_meta_box( $post ) { $current_disable_highlights = get_post_meta( $post->ID, '_post_disable_highlights', true ); $current_disable_feature_img = get_post_meta( $post->ID, '_post_disable_feature_img', true ); $current_report_cover_url = get_post_meta( $post->ID, '_post_report_cover_url', true ); - $current_disable_post_bottom_icon = get_post_meta( $post->ID, '_post_disable_post_bottom_icon', true ); $current_disable_post_authors = get_post_meta( $post->ID, '_post_disable_post_authors', true ); $current_disable_post_categories = get_post_meta( $post->ID, '_post_disable_post_categories', true ); $current_custom_css = get_post_meta( $post->ID, '_post_custom_css', true ); @@ -207,12 +206,6 @@ function post_save_meta_box_data( $post_id ) { } else { update_post_meta( $post_id, '_post_disable_feature_img', '' ); } - // Disable Icon at Bottom of posts. - if ( isset( $_REQUEST['disable_post_bottom_icon'] ) ) { - update_post_meta( $post_id, '_post_disable_post_bottom_icon', sanitize_text_field( $_POST['disable_post_bottom_icon'] ) ); - } else { - update_post_meta( $post_id, '_post_disable_post_bottom_icon', '' ); - } // Disable Authors at Bottom of the post. if ( isset( $_REQUEST['disable_post_authors'] ) ) { update_post_meta( $post_id, '_post_disable_post_authors', sanitize_text_field( $_POST['disable_post_authors'] ) ); From e4d6a47a2cab43dea815aa3adfda2ddb30a96e2d Mon Sep 17 00:00:00 2001 From: dlousa92 Date: Fri, 12 Apr 2019 10:00:49 -0400 Subject: [PATCH 3/6] comment out template function for now --- .../aerospace/inc/template-functions.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wp-content/themes/aerospace/inc/template-functions.php b/wp-content/themes/aerospace/inc/template-functions.php index cc202600..5e73f746 100755 --- a/wp-content/themes/aerospace/inc/template-functions.php +++ b/wp-content/themes/aerospace/inc/template-functions.php @@ -140,16 +140,16 @@ function aerospace_img_caption_shortcode_filter($val, $attr, $content = null) * @param string $content The post content. * @return string The modified post content. */ -function aerospace_add_logo_to_post_content( $content ) { - global $post; - if ( $post->post_type == 'post' ) { - $disable_icon = get_post_meta( $post->ID, '_post_disable_post_bottom_icon', true ); - if ( ! $disable_icon ) { - $content .= do_shortcode('[aircraft]'); - } - } - return $content; -} +// function aerospace_add_logo_to_post_content( $content ) { +// global $post; +// if ( $post->post_type == 'post' ) { +// $disable_icon = get_post_meta( $post->ID, '_post_disable_post_bottom_icon', true ); +// if ( ! $disable_icon ) { +// $content .= do_shortcode('[aircraft]'); +// } +// } +// return $content; +// } // add_filter('the_content', 'aerospace_add_logo_to_post_content', 0); /** From da87d0fb76c7213736e2106d9ff9053ef3d9123b Mon Sep 17 00:00:00 2001 From: dlousa92 Date: Mon, 15 Apr 2019 14:38:45 -0400 Subject: [PATCH 4/6] add aircraft plugin --- .gitignore | 1 + wp-content/plugins/aircraft/aircraft.js | 26 ++++++++++++++++++++++++ wp-content/plugins/aircraft/aircraft.php | 19 +++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 wp-content/plugins/aircraft/aircraft.js create mode 100644 wp-content/plugins/aircraft/aircraft.php diff --git a/.gitignore b/.gitignore index 27169169..80204d3e 100644 --- a/.gitignore +++ b/.gitignore @@ -106,6 +106,7 @@ Thumbs.db # track these mu-plugins, plugins, and themes # add your own entries here +!wp-content/plugins/aircraft !wp-content/plugins/aerospace-google-analytics.php !wp-content/plugins/aerospace-menu-item-custom-fields.php !wp-content/plugins/search-filter-pro diff --git a/wp-content/plugins/aircraft/aircraft.js b/wp-content/plugins/aircraft/aircraft.js new file mode 100644 index 00000000..8ccb80ad --- /dev/null +++ b/wp-content/plugins/aircraft/aircraft.js @@ -0,0 +1,26 @@ +( function( wp ) { + + const aircraftShortcode = function ( props ) { + return wp.element.createElement( + wp.editor.RichTextToolbarButton, { + icon: 'editor-code', + title: 'Aircraft Shortcode', + onClick: function() { + props.onChange( wp.richText.toggleFormat( + props.value, + { type: 'aircraft-shortcode/sample-output' } + )); + }, + isActive: props.isActive, + } + ) + } + wp.richText.registerFormatType( + 'aircraft-shortcode/sample-output',{ + title: 'Aircraft Shortcode', + tagName: 'img', + className: 'img-aircraft', + edit: aircraftShortcode + } + ); +})( window.wp ); \ No newline at end of file diff --git a/wp-content/plugins/aircraft/aircraft.php b/wp-content/plugins/aircraft/aircraft.php new file mode 100644 index 00000000..0363d382 --- /dev/null +++ b/wp-content/plugins/aircraft/aircraft.php @@ -0,0 +1,19 @@ + Date: Wed, 17 Apr 2019 15:49:00 -0400 Subject: [PATCH 5/6] have aircraft shortcode insert when button is clicked --- wp-content/plugins/aircraft/aircraft.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/wp-content/plugins/aircraft/aircraft.js b/wp-content/plugins/aircraft/aircraft.js index 8ccb80ad..8021dbfa 100644 --- a/wp-content/plugins/aircraft/aircraft.js +++ b/wp-content/plugins/aircraft/aircraft.js @@ -6,21 +6,14 @@ icon: 'editor-code', title: 'Aircraft Shortcode', onClick: function() { - props.onChange( wp.richText.toggleFormat( + props.onChange( wp.richText.insert( props.value, - { type: 'aircraft-shortcode/sample-output' } + valueToInsert = '[aircraft]', + startIndex = props.value.start, + endIndex = props.value.end )); }, - isActive: props.isActive, } ) } - wp.richText.registerFormatType( - 'aircraft-shortcode/sample-output',{ - title: 'Aircraft Shortcode', - tagName: 'img', - className: 'img-aircraft', - edit: aircraftShortcode - } - ); })( window.wp ); \ No newline at end of file From 2a621104c56899659df9998b4a31377817f4dc73 Mon Sep 17 00:00:00 2001 From: dlousa92 Date: Thu, 18 Apr 2019 10:03:36 -0400 Subject: [PATCH 6/6] add registerformattype for button --- wp-content/plugins/aircraft/aircraft.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-content/plugins/aircraft/aircraft.js b/wp-content/plugins/aircraft/aircraft.js index 8021dbfa..51d2a8f0 100644 --- a/wp-content/plugins/aircraft/aircraft.js +++ b/wp-content/plugins/aircraft/aircraft.js @@ -16,4 +16,12 @@ } ) } + wp.richText.registerFormatType( + 'aircraft-shortcode/sample-output',{ + title: 'Aircraft Shortcode', + tagName: 'samp', + className: null, + edit: aircraftShortcode + } + ); })( window.wp ); \ No newline at end of file