Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Moving from child theme to Code snippets: Code error

$
0
0

Replies: 0

I’ve followed this tutorial to add custom styling to the wordpress editor. For example, I created a child theme and to functions.php I added:

function add_style_select_buttons( $buttons ) {
	array_unshift( $buttons, 'styleselect' );
	return $buttons;
}
add_filter( 'mce_buttons_2', 'add_style_select_buttons' );

I all worked. But now I no longer want to use a child theme and instead add the code by using the Code Snippets plugin. However, when I add the above code (and the same problem is there for other code) as a Snippet and want to activate it, I get the error:

The snippet has been deactivated due to an error on line 2:
Cannot redeclare function add_style_select_buttons.

What adjustment do I need to make as to make this work with Code Snippets instead of a Child theme?


Viewing all articles
Browse latest Browse all 59525

Trending Articles