Last active
February 24, 2023 14:30
-
-
Save LeoLopesWeb/097cd43a2e93ce955476e6f19220df9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // create a text field that takes the value of the chosen taxonomy via javascript | |
| // functiom.php | |
| function webroom_add_custom_js_file_to_admin( $hook ) { | |
| wp_enqueue_script( 'admin-js', get_stylesheet_directory_uri() . '/assets/js/admin-js.js' ); | |
| } | |
| add_action('admin_enqueue_scripts', 'webroom_add_custom_js_file_to_admin'); | |
| // admin-js.js | |
| (function ($) { | |
| $(document).ready(function (e) { | |
| $("div[data-name='formato_escolhido'] input").attr("readonly", true); | |
| $("div[data-name='formato'] label").each(function () { | |
| $(this).click(function () { | |
| var label = $(this).find("span").text(); | |
| //console.log(label); | |
| $("div[data-name='formato_escolhido'] input").val(label).trigger("change"); | |
| }); | |
| }); | |
| }); | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment