function wpex_remove_actions() { $hooks = wpex_theme_hooks(); foreach ($hooks as $section => $array) { if (!empty($array['hooks']) && is_array($array['hooks'])) { foreach ($array['hooks'] as $hook) { remove_all_actions($hook, false); } } } }
/** * Remove the footer and add custom footer if enabled * * @since 2.0.0 */ public function alter_footer() { // Remove theme footer remove_action('wpex_hook_wrap_bottom', 'wpex_footer', 10); // Remove all actions in footer hooks $hooks = wpex_theme_hooks(); if (isset($hooks['footer']['hooks'])) { foreach ($hooks['footer']['hooks'] as $hook) { remove_all_actions($hook, false); } } // Re add callout add_action('wpex_hook_footer_before', 'wpex_footer_callout'); // Re add reveal if enabled if (get_theme_mod('footer_reveal')) { add_action('wpex_hook_footer_before', 'wpex_footer_reveal_open', 0); add_action('wpex_hook_footer_after', 'wpex_footer_reveal_close', 99); } // Add builder footer add_action('wpex_hook_wrap_bottom', array($this, 'get_part'), 10); // Remove widgets unregister_sidebar('footer_one'); unregister_sidebar('footer_two'); unregister_sidebar('footer_three'); unregister_sidebar('footer_four'); }
/** * Settings page output * * @since 3.0.0 */ public function create_admin_page() { ?> <div class="wrap wpex-custom-actions-admin-wrap"> <h1 style="padding-right:0;"><?php _e('Custom Actions', 'wpex'); ?> </h1> <?php // Error notice for WP_Debug if (!defined('WP_DEBUG') || WP_DEBUG == false) { ?> <div class="notice error"> <p><?php _e('WP_DEBUG is disabled is currently disabled. It is highly recommended to enable it before adding action hooks incase you make a PHP error.', 'wpex'); ?> </p> </div> <?php } ?> <form method="post" action="options.php"> <?php settings_fields('wpex_custom_actions'); ?> <?php $options = get_option('wpex_custom_actions'); ?> <div id="poststuff" class="wpex-custom-actions"> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <div id="post-body-content" class="postbox-container"> <div class="meta-box-sortables ui-sortable"> <?php // Get hooks $wp_hooks = array('wp_hooks' => array('label' => 'WordPress', 'hooks' => array('wp_head', 'wp_footer'))); $hooks = $wp_hooks + wpex_theme_hooks(); // Loop through sections foreach ($hooks as $section) { ?> <h2><?php echo $section['label']; ?> </h2> <?php // Loop through hooks $hooks = $section['hooks']; foreach ($hooks as $hook) { // Get data $action = !empty($options[$hook]['action']) ? $options[$hook]['action'] : ''; $php = isset($options[$hook]['php']) ? true : false; $priority = isset($options[$hook]['priority']) ? intval($options[$hook]['priority']) : 10; ?> <div class="postbox closed"> <div class="handlediv" title="Click to toggle"></div> <h3 class="hndle<?php if ($action) { echo ' active'; } ?> "><span><span class="dashicons dashicons-editor-code" style="padding-right:10px;"></span><?php echo $hook; ?> </span></h3> <div class="inside"> <p> <label><?php _e('Code', 'wpex'); ?> </label> <textarea placeholder="<?php esc_attr_e('Enter your custom action here…', 'wpex'); ?> " name="wpex_custom_actions[<?php echo $hook; ?> ][action]" rows="10" cols="50" style="width:100%;" class="wpex-textarea"><?php echo esc_textarea($action); ?> </textarea> </p> <p class="clr"> <label><?php _e('Enable PHP', 'wpex'); ?> </label> <input name="wpex_custom_actions[<?php echo $hook; ?> ][php]" type="checkbox" value="" class="wpex-enable-php" <?php checked($php, true); ?> > </p> <p class="clr"> <label><?php _e('Priority', 'wpex'); ?> </label> <input name="wpex_custom_actions[<?php echo $hook; ?> ][priority]" type="number" value="<?php echo $priority; ?> " class="wpex-priority"> </p> </div><!-- .inside --> </div><!-- .postbox --> <?php } ?> <?php } ?> </div><!-- .meta-box-sortables --> </div><!-- #post-body-content --> <div id="postbox-container-1" class="postbox-container"> <div class="postbox"> <h3 class='hndle'><span><span class="dashicons dashicons-flag" style="margin-right:7px;"></span><?php _e('Important PHP Notice', 'wpex'); ?> </span></h3> <div class="inside"> <p><?php _e('If you have enabled PHP for any action you MUST wrap your code in PHP tags. The theme will use the eval() function for outputting your PHP. Please be aware of the possibly security vulnerabilities this entails.', 'wpex'); ?> </p> <a href="http://php.net/manual/en/function.eval.php" title="<?php _e('Learn More', 'wpex'); ?> " target="_blank" class="button button-secondary"><?php _e('Learn More', 'wpex'); ?> </a> </div><!-- .inside --> </div><!-- .postbox --> <div class="postbox"> <h3 class='hndle'><span><span class="dashicons dashicons-upload" style="margin-right:7px;"></span><?php _e('Save Your Actions', 'wpex'); ?> </span></h3> <div class="inside"> <p><?php _e('Click the button below to save your custom actions.', 'wpex'); ?> </p> <?php submit_button(); ?> </div><!-- .inside --> </div><!-- .postbox --> </div><!-- .postbox-container --> </div><!-- #post-body-content --> </div><!-- #post-body --> </div><!-- #poststuff --> </form> <script> ( function( $ ) { "use strict"; $( document ).ready( function() { $( '.wpex-custom-actions .handlediv, .wpex-custom-actions .hndle' ).click( function( e ) { e.preventDefault(); $( this ).parent().toggleClass( 'closed' ); } ); } ); } ) ( jQuery ); </script> </div><!-- .wrap --> <?php }