Created
November 28, 2019 03:02
-
-
Save garvs/8fb0b0249271c024bad9d558bb0e79bc to your computer and use it in GitHub Desktop.
Add JavaScript code to front-end page for a role
This file contains 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
<?php | |
// Additional options for URE | |
// Hide parts of front-end page for selected role | |
add_filter( 'ure_role_additional_options', 'ure_add_front_end_js_option', 10, 1 ); | |
function ure_add_front_end_js_option( $items ) { | |
$item = URE_Role_Additional_Options::create_item( 'change_front_end_css', esc_html__('Change Front-end CSS', 'user-role-editor'), 'init', 'ure_add_front_end_js_init' ); | |
$items[$item->id] = $item; | |
return $items; | |
} | |
function ure_add_front_end_js_init() { | |
wp_enqueue_script( 'jquery' ); | |
add_action( 'wp_footer', 'ure_add_front_end_js' ); | |
} | |
function ure_add_front_end_js() { | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function() { | |
jQuery('.header-inner').hide(); | |
}); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment