Created
March 24, 2014 20:04
-
-
Save alexknowshtml/9747917 to your computer and use it in GitHub Desktop.
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
/*Barley Overrides*/ | |
if ( !isset($_GET['barley_editor']) || $_GET['barley_editor'] !== 'on' ) | |
$_GET['barley_editor'] = 'off'; | |
remove_filter('edit_post_link', 'barley_custom_edit_post_link'); | |
// Change "Edit" to "Edit Advanced Options" when template uses edit_post_link | |
function indyhall_barley_custom_edit_post_link($output) { | |
if ( is_single() || is_page() ) { // Only replace this link on single or pages | |
$output = str_replace('Edit', 'Edit Advanced Options', $output); | |
$barley_querystring_separator = (isset($_GET['p']) && $_GET['p']) ? '&' : '?'; | |
if ( isset($_GET['barley_editor']) && $_GET['barley_editor'] == 'off' ) { | |
$output .= ' | <a href="'.get_permalink().$barley_querystring_separator.'barley_editor=on">' . __( 'Turn Barley Editor on', 'barley-for-wordpress' ) . '</a>'; | |
} else { | |
$output .= ' | <a href="'.get_permalink().$barley_querystring_separator.'barley_editor=off">' . __( 'Turn Barley Editor off', 'barley-for-wordpress' ) . '</a>'; | |
} | |
} | |
return $output; | |
} | |
add_filter('edit_post_link', 'indyhall_barley_custom_edit_post_link'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment