Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

some of my code snippets you may wish to consider for addition #4

Open
Colinsp opened this issue Jun 27, 2014 · 4 comments
Open

some of my code snippets you may wish to consider for addition #4

Colinsp opened this issue Jun 27, 2014 · 4 comments

Comments

@Colinsp
Copy link

Colinsp commented Jun 27, 2014

/** Execute PHP code in a standard text widget **/
add_filter('widget_text','execute_php',100);
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}

//Add buttons to the Editor
function add_more_buttons($buttons) {
$buttons[] = 'hr';
$buttons[] = 'del';
$buttons[] = 'sub';
$buttons[] = 'sup';
$buttons[] = 'anchor';
$buttons[] = 'fontselect';
$buttons[] = 'fontsizeselect';
$buttons[] = 'cleanup';
$buttons[] = 'styleselect';
return $buttons;
}
add_filter("mce_buttons_2", "add_more_buttons");

/*Execute a shortcode in a text widget */
add_filter('widget_text', 'do_shortcode');

//Turn on 'Kitchen Sink' for all users
function unhide_kitchensink( $args ) {
$args['wordpress_adv_hidden'] = false;
return $args;
}
add_filter( 'tiny_mce_before_init', 'unhide_kitchensink' );

//Remove Howdy
function replace_howdy( $wp_admin_bar ) {
$my_account=$wp_admin_bar->get_node('my-account');
$newtitle = str_replace( 'Howdy,', ' ', $my_account->title );
$wp_admin_bar->add_node( array(
'id' => 'my-account',
'title' => $newtitle,
) );
}
add_filter( 'admin_bar_menu', 'replace_howdy',25 );

@DevinWalker
Copy link
Owner

This is great. Definitely will pull this into the plugin

@DevinWalker
Copy link
Owner

Would you mind submitting a pull request?

@Colinsp
Copy link
Author

Colinsp commented Jun 29, 2014

Devin,
I will have a go but I have never managed to get my head around how Git works.

@Colinsp
Copy link
Author

Colinsp commented Jun 29, 2014

Sorry still don't understand this programme. I have read the help and am none the wiser. Sorry.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants