Created
September 26, 2013 13:48
-
-
Save rsharrer/6714476 to your computer and use it in GitHub Desktop.
Ace Doran Functions
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
| <?php | |
| // Add Builder 3.0 Support | |
| add_theme_support( 'builder-3.0' ); | |
| // Making all module outer wrappers full width | |
| function it_set_full_width_container( $width ) { | |
| remove_filter( 'builder_get_container_width', 'it_set_full_width_container' ); | |
| return ''; | |
| } | |
| add_filter( 'builder_get_container_width', 'it_set_full_width_container' ); | |
| function it_set_full_width_module( $fields ) { | |
| global $it_original_module_width; | |
| $it_original_module_width = ''; | |
| foreach ( (array) $fields['attributes']['style'] as $index => $value ) { | |
| if ( preg_match( '/^(width:.+)/i', $value, $matches ) ) { | |
| $it_original_module_width = $matches[1]; | |
| unset( $fields['attributes']['style'][$index] ); | |
| } | |
| if ( preg_match( '/^overflow:/', $value ) ) { | |
| unset( $fields['attributes']['style'][$index] ); | |
| $fields['attributes']['style'][] = 'overflow:visible;'; | |
| } | |
| } | |
| add_filter( 'builder_module_filter_inner_wrapper_attributes', 'it_constrain_full_width_module_inner_wrapper' ); | |
| return $fields; | |
| } | |
| add_filter( 'builder_module_filter_outer_wrapper_attributes', 'it_set_full_width_module' ); | |
| function it_constrain_full_width_module_inner_wrapper( $fields ) { | |
| global $it_original_module_width; | |
| remove_filter( 'builder_module_filter_inner_wrapper_attributes', 'it_constrain_full_width_module_inner_wrapper' ); | |
| $fields['attributes']['style'][] = $it_original_module_width; | |
| $fields['attributes']['style'][] = 'margin:0 auto;'; | |
| $it_original_module_width = ''; | |
| return $fields; | |
| } | |
| // Adds classes to modules | |
| if ( ! function_exists( 'it_builder_loaded' ) ) { | |
| function it_builder_loaded() { | |
| builder_register_module_style( 'widget-bar', 'Dark', 'widget-bar-dark' ); | |
| builder_register_module_style( 'widget-bar', 'Alternate', 'widget-bar-alternate' ); | |
| builder_register_module_style( 'image', 'Alternate', 'image-alternate' ); | |
| builder_register_module_style( 'html', 'Alternate', 'html-alternate' ); | |
| } | |
| add_action( 'it_libraries_loaded', 'it_builder_loaded' ); | |
| } | |
| //Show Only Current Author's Posts | |
| function mypo_parse_query_useronly( $wp_query ) { | |
| if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) { | |
| if ( !current_user_can( 'level_10' ) ) { | |
| global $current_user; | |
| $wp_query->set( 'author', $current_user->id ); | |
| } | |
| } | |
| } | |
| add_filter('parse_query', 'mypo_parse_query_useronly' ); | |
| // Edit Items in Admin Menu for Editor and Below | |
| function mytheme_admin_bar_render() { | |
| global $wp_admin_bar; | |
| $wp_admin_bar->remove_menu('comments'); | |
| $wp_admin_bar->remove_menu('builder'); | |
| $wp_admin_bar->remove_menu('ether-ether'); | |
| $wp_admin_bar->remove_menu('post-new'); | |
| $wp_admin_bar->add_menu( array( | |
| 'id' => 'my_freight', | |
| 'title' => __('My Freight'), | |
| 'href' => admin_url( 'edit.php?post_type=freight') | |
| ) ); | |
| } | |
| if ( !current_user_can( 'level_10' ) ) { | |
| add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' ); | |
| } | |
| //Remove Admin ToolBar Items | |
| function remove_admin_toolbar_links() { | |
| global $wp_admin_bar; | |
| $wp_admin_bar->remove_menu('wp-logo'); | |
| $wp_admin_bar->remove_menu('updates'); | |
| $wp_admin_bar->remove_menu('comments'); | |
| $wp_admin_bar->remove_menu('new-content'); | |
| } | |
| add_action('wp_before_admin_bar_render', 'remove_admin_toolbar_links'); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment