diff --git a/hangar-wp-plugin.php b/hangar-wp-plugin.php index 020f338..d0034a2 100644 --- a/hangar-wp-plugin.php +++ b/hangar-wp-plugin.php @@ -15,7 +15,7 @@ * Author URI: https://vitrubio.net/ * License: GPL 3.0 * License URI: https://www.gnu.org/licenses/gpl-3.0.html -* Text Domain: hangar-wpplugin +* Text Domain: hangar-wpplugin-textdomain * Domain Path: /languages */ @@ -54,10 +54,12 @@ include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-stylesheet-admin.php'); include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-stylesheet-public.php'); -include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-custom-post-type-resources.php'); - include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-tags-and-pages.php'); -//include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-tags-category-shortcode.php'); // outdated from 2012 do not use - include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-plugin-settings-pannel.php'); + +include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-shortcode-metabox-postpage.php'); + +// include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-custom-post-type-resources.php'); + +// include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-tags-category-shortcode.php'); // outdated from 2012 do not use diff --git a/includes/hangar-shortcode-metabox-postpage.php b/includes/hangar-shortcode-metabox-postpage.php new file mode 100644 index 0000000..c487bad --- /dev/null +++ b/includes/hangar-shortcode-metabox-postpage.php @@ -0,0 +1,150 @@ +options for The Green Balloon website wich do not come by default with wordpress such as: selector for showing post or pages in homepage, the text area to show summary for post and pages, the map archive showing tags from posts. +Author: jorge - vitrubio.net +Date: 2020 01 10 +Version: 0.3 +Author URI: https://vitrubio.net/ +License: GPL 3.0 +License URI:https://www.gnu.org/licenses/gpl-3.0.html +*/ + + +/* to use in the template +* include this code in post/page view +* +// // Detect plugin. For use on Front End only. +// include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); +// // check for plugin using plugin name +// if ( is_plugin_active( 'hangar-wp-plugin/hangar-wp-plugin.php' ) ) { +// //plugin is activated do +// hangar_show_extra_content(); +// } +*/ + +/* +if ever read this never forget to check +howto write a pluggin by Wordpress.org +https://codex.wordpress.org/Writing_a_Plugin +and the best practices +https://developer.wordpress.org/plugins/plugin-basics/best-practices/ +*/ +defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* begin pluggin for SHORT CODES IN PAGE OR POST */ +/* + https://themefoundation.com/wordpress-meta-boxes-guide/ +*/ + + +// Adds a meta box to the post editing screen +if ( ! function_exists( 'hangar_extra_content_add_meta_box' ) ) : + function hangar_extra_content_add_meta_box() { + add_meta_box( + 'hangar_extra_content', //$id + 'Hangar: Show extra content', //$title + 'hangar_extra_content_callback', //$callback + array('post', 'page'), // $screen + 'normal', // $context // normal,side,advanced + 'high' // $priority //high, core, default,low + ); + } + add_action( 'add_meta_boxes', 'hangar_extra_content_add_meta_box'); +endif; + +// Outputs the content of the meta box +if ( ! function_exists( 'hangar_extra_content_callback' ) ) : + function hangar_extra_content_callback( $post ) { + wp_nonce_field( basename( __FILE__ ), 'hangar_extra_content_nonce' ); + $hangar_extra_content_stored_meta = get_post_meta( $post->ID ); + ?> +

+ + [shortcode] que genera el icono PFC que ves en la barra de edición de texto.', 'hangar-wpplugin-textdomain' )?> +

+
+

+

+ +

+ 'hangar_extra_content_wysiwyg_summary', + 'media_buttons' => true, + 'textarea_rows' => 3, + // https://www.kevinleary.net/customizing-tinymce-wysiwyg-editor-wordpress/ + // 'tinymce' => array( + // 'toolbar1' => 'formatselect,bold,italic,link,unlink,charmap,removeformat,wp_more', + // 'toolbar2' => '', + // 'toolbar3' => '', + // ), + ); + wp_editor( $content,$editor_id,$settings); ?> +
+

+ '; + echo $meta_value; + echo ''; + } + } + + } // end function hangar_show_extra_content + endif; +/* * * * * * * * + + +/* * * * * * * * * + +/* end pluggin for SHORT CODES IN PAGE OR POST */ +/* * * * * * * * * * * * * * * * * * * * * * * * */