Fixing the Add New Button in Magic Fields

2015-08-28 – See updates for WordPress 4.3 below.

The Magic Fields plugin is a great plugin for customizing Wordress.  I prefer Magic Fields 1 as opposed to Magic Fields 2.  However the is one flaw that tends to annoy people and make it difficult to repeatedly add new pages.

Normally when creating a new page, you would go the the Write Panel, then click Add New.  You then proceed to add content and publish your page.  You now want to add a new page within that same Write Panel.  If you click the Add New button at the top of the already created page you would expect it to create a new page within that Write Panel.  It does not.  Instead it creates a new standard WordPress page.  This can be confusing to people that are not familiar with how WordPress and Magic Fields functions   It is also just annoying.  The below code fixes this issue and makes the Add New button function as expected.

Add the following

To one of the javascript areas in the ApplyCustomWritePanelHeader( ) function of the RCCWP_WritePostPage.php file.  In version 1.6.1 this is around line 293 of that file.

You should also add the following to MF_ManageWritePanels.php right after line 113 within the change_title_manage function.

You should then end up with something that looks like this for the change_title_manage function…

UPDATE for WordPress 4.3

The above has been updated for WordPress 4.3. In WordPress 4.3 the class for the “Add New” button changed. The new selector is ” a.page-title-action” which has been added to the examples above.

Additionally you will need to update the “manage_page.js” file which is located in the “js” folder.

Update this function (around line 171)

Change all the “h2” references to “h1”, you can replace that whole function with the one below.

 

3 thoughts on “Fixing the Add New Button in Magic Fields

  1. olivier on

    Hey,

    This is working great for the tab New (inside WordPress menu) but not working for
    Manage >> [your white panel page] [Add New] => add new send to regular page
    I checked it the same page, but I guess the jquery function is not call
    Do you have another tip ?

    • I’ve updated my post the address your other issue. I doubt this will ever be merged into Magic Fields 1 as I think most development is focused on Magic Fields 2

Leave a Reply

Your email address will not be published. Required fields are marked *