Home / functions.php / Add subscript and superscript buttons to editor
  • How to Add subscript and superscript buttons to editor

    add-subscript-and-supscript-buttons-to-editor

    Adding this PHP snippet to the functions.php of your wordpress template will add subscript and superscript buttons to the wordpress editor.

    wordpress snippet : PHP

    <>
    function enable_more_buttons($buttons) {
      $buttons[] = 'sub';
      $buttons[] = 'sup';
      return $buttons;
    }
    add_filter("mce_buttons_3", "enable_more_buttons");
    

    ( WordPress codex functions, hooks, in this snippet. )

    add_filter,
  • Myst1010

    (text translated by the program)
    Thank you for providing this code, but no need to repeat the array code, simply separate the items in the array

    function enable_more_buttons($buttons) {
    $buttons[] = ‘sub , sup';
    return $buttons;
    }
    add_filter(“mce_buttons_2″, “enable_more_buttons”);

    • http://wpsnipp.com Kevin Chard

      This is true, I just find this method easier to read. Thanks for the input though people will find this very useful.

  • Jerry DeFoe

    thanks guys.  i was working with a PhD client today who writes research
    reports and it was necessary for her to sup and sub references.  this
    was key.

    • http://wpsnipp.com Kevin Chard

      Perfect Jerry glad to hear you got things working well.

  • Tom Schreurs

    Perfect little piece of code! Works brilliant. Thanks a lot!

    • http://wpsnipp.com Kevin Chard

      No problem glad that I could help!

  • http://enviro-soil.com/ Donald G. McGahan

    When I add it, I get a

    Fatal error: Call to undefined function add_filter()

  • http://twitter.com/Design_Deeper Design Deeper

    Just what I was looking for!

  • pistik

    thanks fot tip

  • http://twitter.com/fuzzybee7 Nguy?n Trung D?ng

    you saved my day man

  • Ryan Hughes

    I am getting a Missing argument 1 for enable_more_buttons() error