Changeset 3115915
- Timestamp:
- 07/10/2024 10:09:00 PM (4 weeks ago)
- Location:
- menu-item-types-button/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
menu-item-types-button/trunk/acf/button-field-group.php
r2646961 r3115915 1 1 <?php 2 2 3 defined( 'ABSPATH' ) or die(); 4 5 if( function_exists('acf_add_local_field_group') ){ 6 7 8 acf_add_local_field_group(array( 9 'key' => 'group_mitypes_button_61b136d8bcf78', 10 'title' => __( 'Button', 'mitypes-button' ), 11 'fields' => array( 3 return array( 4 5 'key' => 'group_mitypes_button_61b136d8bcf78', 6 'title' => __( 'Button', 'mitypes-button' ), 7 'fields' => array( 8 array( 9 'key' => 'field_mitypes_button_61b136ec53e37', 10 'label' => 'URL', 11 'name' => 'mitypes_button_url', 12 'type' => 'url', 13 'instructions' => '', 14 'required' => 0, 15 'conditional_logic' => 0, 16 'wrapper' => array( 17 'width' => '', 18 'class' => '', 19 'id' => '', 20 ), 21 'default_value' => '', 22 'placeholder' => '', 23 ), 24 array( 25 'key' => 'field_mitypes_button_61b1370d53e38', 26 'label' => __( 'Button Target', 'mitypes-button' ), 27 'name' => 'mitypes_button_target_blank', 28 'type' => 'true_false', 29 'instructions' => '', 30 'required' => 0, 31 'conditional_logic' => 0, 32 'wrapper' => array( 33 'width' => '', 34 'class' => '', 35 'id' => '', 36 ), 37 'message' => __( 'Open link in new tab', 'mitypes-button' ), 38 'default_value' => 0, 39 'ui' => 0, 40 'ui_on_text' => '', 41 'ui_off_text' => '', 42 ), 43 ), 44 'location' => array( 45 array( 12 46 array( 13 'key' => 'field_mitypes_button_61b136ec53e37', 14 'label' => 'URL', 15 'name' => 'mitypes_button_url', 16 'type' => 'url', 17 'instructions' => '', 18 'required' => 0, 19 'conditional_logic' => 0, 20 'wrapper' => array( 21 'width' => '', 22 'class' => '', 23 'id' => '', 24 ), 25 'default_value' => '', 26 'placeholder' => '', 27 ), 28 array( 29 'key' => 'field_mitypes_button_61b1370d53e38', 30 'label' => __( 'Button Target', 'mitypes-button' ), 31 'name' => 'mitypes_button_target_blank', 32 'type' => 'true_false', 33 'instructions' => '', 34 'required' => 0, 35 'conditional_logic' => 0, 36 'wrapper' => array( 37 'width' => '', 38 'class' => '', 39 'id' => '', 40 ), 41 'message' => __( 'Open link in new tab', 'mitypes-button' ), 42 'default_value' => 0, 43 'ui' => 0, 44 'ui_on_text' => '', 45 'ui_off_text' => '', 47 'param' => 'mitypes', 48 'operator' => '==', 49 'value' => 'button', 46 50 ), 47 51 ), 48 'location' => array( 49 array( 50 array( 51 'param' => 'mitypes', 52 'operator' => '==', 53 'value' => 'button', 54 ), 55 ), 56 ), 57 'menu_order' => 0, 58 'position' => 'normal', 59 'style' => 'default', 60 'label_placement' => 'top', 61 'instruction_placement' => 'label', 62 'hide_on_screen' => '', 63 'active' => true, 64 'description' => '', 65 'show_in_rest' => 0, 66 )); 67 68 } 52 ), 53 'menu_order' => 0, 54 'position' => 'normal', 55 'style' => 'default', 56 'label_placement' => 'top', 57 'instruction_placement' => 'label', 58 'hide_on_screen' => '', 59 'active' => true, 60 'description' => '', 61 'show_in_rest' => 0, 62 ) ; -
menu-item-types-button/trunk/menu-item-types-button.php
r2828227 r3115915 4 4 Plugin URI: https://maxpertici.fr#menu-item-types 5 5 Description: Add the ability to use buttons in your nav menu 6 Version: 1. 26 Version: 1. 7 7 Author: @maxpertici 8 8 Author URI: https://maxpertici.fr … … 18 18 19 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 20 50 * Run plugin - test 21 51 * @since 1.0 … … 23 53 24 54 function mitypes_button_run(){ 25 26 55 if( ! mitypes_button_is_mitypes_loaded() ){ 27 56 add_action('admin_notices', 'mitypes_button_notice_plugin_required'); 28 57 } 29 30 31 58 } 32 59 33 60 add_action( 'plugins_loaded', 'mitypes_button_run' ); 34 35 36 37 /**38 * Add custom nav menu item39 */40 function mitypes_button_add_item_types( $types ){41 $types[] = array(42 'slug' => "button",43 'icon' => plugin_dir_url( __FILE__ ) . 'img/mitypes-button.svg',44 'label' => __( 'Button', 'mitypes-button' ),45 'field-group' => plugin_dir_path( __DIR__ ) . 'menu-item-types-button/acf/button-field-group.php',46 'render' => plugin_dir_path( __DIR__ ) . 'menu-item-types-button/render/button.php',47 );48 return $types;49 }50 51 add_filter( 'mitypes_item_types', 'mitypes_button_add_item_types' );52 53 54 55 /**56 * Handle attributes : skip href57 */58 59 function mitypes_button_attributes_skiper( $atts, $item, $args, $depth, $custom_item_type ){60 if( ( 'button' === $custom_item_type ) ){ unset( $atts['href'] ); }61 return $atts ;62 }63 64 add_filter( 'mitypes_nav_menu_link_attributes', 'mitypes_button_attributes_skiper', 11, 5 );65 61 66 62 -
menu-item-types-button/trunk/readme.txt
r2828227 r3115915 4 4 Tags: Menu, Custom, Nav item, Button, CTA 5 5 Requires at least: 5.8 6 Tested up to: 6. 17 Stable tag: 1. 26 Tested up to: 6. 7 Stable tag: 1. 8 8 Requires PHP: 7.0 9 9 License: GPLv2 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 11 12 12 13 13 14 == Description == … … 36 37 == Changelog == 37 38 39 40 41 42 43 38 44 = 1.2 = 39 45 * Version bump -
menu-item-types-button/trunk/render/button.php
r2646961 r3115915 21 21 22 22 $target = '_self' ; 23 24 if( isset( $blank ) && '1' === $blank ){ $target = '_blank' ; } 23 if( isset( $blank ) && ( '1' === $blank || true === $blank ) ){ $target = '_blank' ; } 25 24 26 25 echo wp_kses( $args->before, $a_tags );
Note: See TracChangeset
for help on using the changeset viewer.