Quick Add Child joined the 1Fix.io plugin family today. If you need to add lots of child posts for your WordPress site, the little one is for you.
I found it very annoying when I need to select the Parent Page from 30+ pages. It might be rare, but when this is the case, you’ll be thankful if you don’t have to select the Parent manually.
Quick Add Child creates 2 links on a hierarchical post (like Page) editing screen, just right after the “Add New” link. The 2 links are “Add New Sibling” and “Add New Child“. As the names indicate, the links will open in new browser tabs, the cool part is if you take a look at the “Parent” field in “Page Attributes” metabox, it has been selected automatically.
Add links to H2 tag on the post editing screen
To Add links to H2 tag after the “Add New”, the only way I figured out is inserting the HTML code with JavaScript. Unlike the page_row_actions
filter built in WordPress Core, there is no such a hook for this. I add new links with the jQuery function below:
Since we could add links to it, we could also remove the “Add New” with JavaScript. I create an option on the Settings page for you to decide if you’d like to hide the “Add New” link.
page_attributes_dropdown_pages_args does the trick
The other key function for this plugin is to pre-select the Parent in Page Attributes metabox. Luckily we’ve got a filter to use this time.
page_attributes_dropdown_pages_args
is a filter to let you modify the arguments which will be passed to wp_dropdown_pages
later. The defaults for the arguments are:
So we could pre-select the Parent by setting $dropdown_args['selected']
to a specific value, in this case, a $_GET variable ($_GET[‘parent_id’]) passed from the “Add New Sibling / Child” link.
Bonus tips: create a banner for the WordPress plugin repository
It’s the first time I create a banner for the plugins of 1Fix.io. For the simplicity of Quick Add Child, I hope people could get the idea of what it’s all about at first glance.
I’d like to address the 2 links “Add New Sibling” and “Add New Child” added by the plugin, here’s what I did:
- Make a screenshot of the page editing screen.
- Resize the image by 110%.
- Rotate the image just 3 degree counterclockwise.
- Crop the image to fit the right size for the banner (772*250 px).
With such simple steps, I create a pretty straightforward banner for Quick Add Child. When people visit the plugin repository on WordPress.org, they’ll get the idea before reading the description.
Any feedback or comments are welcome. Stay tuned to get more plugin updates from 1Fix.io!
Leave a Reply