Theme Tip: Bridge Theme Meta Boxes in a Custom Post Type

We needed to add the Bridge – Creative Multi-Purpose WordPress Theme meta boxes to a custom post type. This article helped to get us started but there were a few edits, updates, and clarifications as well.

Adding Bridge Theme/Qode meta boxes to custom post type.

Assuming you have already created a Custom Post Type (which can be done via a plugin like Custom Post Type UI, Pods, etc.), the steps below will help you integrate Qode’s Custom Meta Boxes for the custom post type.

In the example below, we are used a custom post type “Broadcasts” with a slug of “broadcast”, so everywhere you see “broadcast”, just substitute your custom post type’s slug.

    1. Create a folder and map.php file for your custom post type via FTP: In /wp-content/themes/bridge/framework/admin/meta-boxes: duplicate the “post” folder and rename it to your custom post type (in our case, we are using the “broadcast” custom post type).
    2. Edit the newly created map.php file: The Bridge Theme uses it’s own meta box class QodeMetaBox, so when we duplicated the map.php file above, we need to change the QodeMetaBox("post to QodeMetaBox("broadcast and also change the qodeMetaBoxes->addMetaBox("post to qodeMetaBoxes->addMetaBox("broadcast. Here are the steps to streamline this process:
      1. Find/Replace all instances of QodeMetaBox("post with QodeMetaBox("broadcast, then
      2. Find/Replace all instances of qodeMetaBoxes->addMetaBox("post to qodeMetaBoxes->addMetaBox("broadcast. There are 7 instances of each text string (as of 9/2015). The result for the “Qode General” metabox, then, is taking it from this:$qodeGeneral = new QodeMetaBox("post", "Qode General");
        $qodeFramework->qodeMetaBoxes->addMetaBox("post_general",$qodeGeneral);
        to$qodeGeneral = new QodeMetaBox("broadcast", "Qode General");
        $qodeFramework->qodeMetaBoxes->addMetaBox("broadcast_general",$qodeGeneral);
        Again, you can swap these out with your/any other custom post type as well. This example is using the “Broadcast” custom post type for our use case.
    3. Edit qode-meta-boxes-setup.php: After finishing the “Find/Replace” above, you need to include/call your new map.php file into themes/bridge/framework/admin/meta-boxes/qode-meta-boxes-setup.php. This is done by adding your custom post type to the require_once lines, preferably at the end after require_once("carousels/map.php"); or require_once("masonry_gallery/map.php"); depending on which version of Bridge you have installed. Our code, using the broadcast custom post type, looked like this: require_once("broadcast/map.php");
    4. Edit qode-framework.php: Finally, the post_type needs to be added in the qode_meta_box_save function, so that the values will actually be saved to the database. You can add this to the array in bridge/framework/qode-framework.php on line 313. The code will go from$postTypes = array( "page", "post", "portfolio_page", "testimonials", "slides", "carousels","masonry_gallery");to:$postTypes = array( "page", "post", "portfolio_page", "testimonials", "slides", "carousels","masonry_gallery", "broadcast");

That’s it! Qode’s custom meta boxes (Qode General, Qode Header, Qode Title, Qode Sidebar, etc.) should now be visible (and useful) in your custom post type. Thanks to the original tip and instructions provided by Pim Schaaf.

P.S. NOTE: Because these are edits being made the actual theme files, save the instructions and text you customized from above so that you can follow these steps again the next time there is a theme update. Unfortunately, adding the framework folder to a child theme will not do the trick as Child Themes can recognize many folders, but that is not one of them.