Changeset 2942233
- Timestamp:
- 07/24/2023 12:32:25 AM (3 years ago)
- Location:
- visual-hook-guide-for-kadence
- Files:
-
- 5 edited
-
assets/banner-1544x500.png (modified) (previous)
-
assets/banner-772x250.png (modified) (previous)
-
trunk/main.js (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/visual-hook-guide-kadence.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
visual-hook-guide-for-kadence/trunk/main.js
r2368222 r2942233 1 'use strict'; 2 1 3 window.onload = function () { 2 var clickSelector = document.querySelectorAll('.kadence-hook input[type=text]'); 3 for (var i = 0; i < clickSelector.length; i++) { 4 clickSelector[i].addEventListener('click', function(){ 5 this.select(); 4 const copyContent = async (text) => { 5 try { 6 await navigator.clipboard.writeText(text); 7 // console.log('Content copied to clipboard'); 8 } catch (err) { 9 console.error('Failed to copy: ', err); 10 } 11 } 12 13 document.querySelectorAll('.kadence-hook input[type=text]').forEach(el => { 14 el.addEventListener('click', function(e){ 15 // Store the original input's text 16 let inputText = e.target.value; 17 18 // Copy the input's text 19 copyContent(inputText); 20 21 // Show confirmation 22 e.target.value = 'Copied ✓'; 23 24 // Restore the original text 25 setTimeout(() => { 26 e.target.value = inputText; 27 }, 1000) 6 28 }); 7 } ;29 }); 8 30 } -
visual-hook-guide-for-kadence/trunk/readme.txt
r2368222 r2942233 5 5 License: GPLv3 6 6 License URI: http://www.gnu.org/licenses/gpl.html 7 Tested up to: 5.57 Tested up to: 6.2.2 8 8 Stable tag: trunk 9 Requires PHP: 5.6.209 Requires PHP: 7.4 10 10 11 Find Kadence action hooks quick and easily by seeing their actual locations inside your Kadence theme.11 Find Kadence action hooks quickly and easily by seeing their actual locations inside your Kadence theme. 12 12 13 13 == Description == … … 17 17 Clicking `Action Hooks` item in the submenu will display the currently available Kadence action hooks on that page. `Clear` clears the hooks. 18 18 19 Clicking anywhere on a hook selects the hook name ready to be easily copied.19 Clicking anywhere on a hook copies the hook name to your clipboard. 20 20 21 21 The hook name is also shown as the tooltip when hovering on a hook. 22 22 23 23 **Kadence theme required.** 24 25 == Kadence Visual Hook Guide Hooks Live Demo ==26 27 [Live Demo](https://kadence-hook-guide.wpdemo.dev/)28 24 29 25 == Frequently Asked Questions == … … 60 56 == Changelog == 61 57 58 = 1.0.1 = 59 Added copy to clipboard function. 60 62 61 = 1.0 = 63 62 Initial Release. -
visual-hook-guide-for-kadence/trunk/visual-hook-guide-kadence.php
r2368222 r2942233 2 2 /** 3 3 * Plugin Name: Visual Hook Guide for Kadence 4 * Plugin URI: https:// buildonlineweb.com/visual-hook-guide-kadence5 * Description: Find Kadence action hooks easily and selectthem by a single click at their actual locations in your Kadence theme.6 * Version: 1.0. 04 * Plugin URI: https://profiles.wordpress.org/srikat/ 5 * Description: Find Kadence action hooks easily and copy them by a single click at their actual locations in your Kadence theme. 6 * Version: 1.0.1 7 7 * Author: Sridhar Katakam 8 * Author URI: https:// buildonlineweb.com/8 * Author URI: https://profiles.wordpress.org/srikat/ 9 9 * Text Domain: visual-hook-guide-kadence 10 10 * License: GPL v3 11 * Requires at least: 5.412 * Requires PHP: 5.6.2011 * Requires at least: 6.2.2 12 * Requires PHP: 7.4 13 13 * 14 14 * This program is free software: you can redistribute it and/or modify … … 37 37 $theme_info = wp_get_theme(); 38 38 39 $kadence_flavors = array(39 $kadence_flavors = [ 40 40 'kadence', 41 );41 ]; 42 42 43 43 if ( ! in_array( $theme_info->Template, $kadence_flavors, true ) ) { 44 44 deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate ourself. 45 45 46 $message = sprintf( 46 47 /* translators: %s: URL to Kadence Framework. */ … … 48 49 esc_url( 'https://www.kadencewp.com/kadence-theme/' ) 49 50 ); 51 50 52 wp_die( $message ); 51 53 } … … 64 66 65 67 $wp_admin_bar->add_menu( 66 array(68 [ 67 69 'id' => 'kvhg', 68 70 'title' => __( 'Kadence Hooks', 'visual-hook-guide-kadence' ), 69 71 'href' => '', 70 72 'position' => 0, 71 )73 ] 72 74 ); 75 73 76 $wp_admin_bar->add_menu( 74 array(77 [ 75 78 'id' => 'kvhg_action', 76 79 'parent' => 'kvhg', … … 78 81 'href' => esc_url( add_query_arg( 'kvhg_hooks', 'show' ) ), 79 82 'position' => 10, 80 )83 ] 81 84 ); 85 82 86 $wp_admin_bar->add_menu( 83 array(87 [ 84 88 'id' => 'kvhg_clear', 85 89 'parent' => 'kvhg', … … 87 91 'href' => esc_url( 88 92 remove_query_arg( 89 array(93 [ 90 94 'kvhg_hooks', 91 )95 ] 92 96 ) 93 97 ), 94 98 'position' => 10, 95 )99 ] 96 100 ); 97 101 … … 108 112 if ( 'show' === filter_input( INPUT_GET, 'kvhg_hooks', FILTER_SANITIZE_STRING ) ) { 109 113 wp_enqueue_style( 'kvhg-styles', $kvhg_plugin_css_url, null, '1.0.0', false ); 110 wp_enqueue_script( 'kvhg-scripts', $kvhg_plugin_js_url, null, '1.0. 0', true );114 wp_enqueue_script( 'kvhg-scripts', $kvhg_plugin_js_url, null, '1.0.1', true ); 111 115 } 112 116 }
Note: See TracChangeset
for help on using the changeset viewer.