Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions wp-content/plugins/aircraft/aircraft.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
( 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.insert(
props.value,
valueToInsert = '[aircraft]',
startIndex = props.value.start,
endIndex = props.value.end
));
},
}
)
}
wp.richText.registerFormatType(
'aircraft-shortcode/sample-output',{
title: 'Aircraft Shortcode',
tagName: 'samp',
className: null,
edit: aircraftShortcode
}
);
})( window.wp );
19 changes: 19 additions & 0 deletions wp-content/plugins/aircraft/aircraft.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/*
Plugin Name: Aircraft Shortcode
*/

function aircraft_script_register() {
wp_register_script(
'aircraft-js',
plugins_url( 'aircraft.js', __FILE__ ),
array( 'wp-rich-text', 'wp-element', 'wp-editor', 'jquery' )
);
}
add_action( 'init', 'aircraft_script_register' );

function aircraft_enqueue_assets_editor() {
wp_enqueue_script( 'aircraft-js' );
}
add_action( 'enqueue_block_editor_assets', 'aircraft_enqueue_assets_editor' );
// ajax for not logged in users
7 changes: 0 additions & 7 deletions wp-content/themes/aerospace/inc/custom-post-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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'] ) );
Expand Down
22 changes: 11 additions & 11 deletions wp-content/themes/aerospace/inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ 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;
}
add_filter('the_content', 'aerospace_add_logo_to_post_content', 0);
// 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);

/**
* Fixes empty <p> and <br> tags showing before and after shortcodes in the
Expand Down