Dynamik Custom Labels

Label your Pages and Posts for Ultimate Design Control! #

This unique feature provides you with the ability to essentially create portable customizations that can then be assigned to pages and posts with the click of your mouse.

How They Work #

To use Custom Labels you simply create a new label below by clicking “Add” and then fill in the “Name” value. Finally you save your change and wait for the page to reload revealing some further information about your new label like the Conditional Tag and Body Class. This information can then be used to create a new Custom Conditional for hooking in Custom Widget Areas and Hook Boxes as well as focusing your Custom CSS on your specific label through its unique Body Class.

After you’ve create your new Custom Label you can then select it on any individual Page, Post or Custom Post Type Post. Then that particular Page or Post will be uniquely affected by styles and content associated with that particular label.

What makes this Custom Label feature so powerful is that you can not only assign labels to your individual content areas, but you can assign as many labels to these page and posts as you like. Kind of like CSS classes these labels allow you to associate your customizations to multiple areas on your site all by simply checking a few boxes when adding/editing your posts and pages.

Naming Your Labels #

When naming your Labels feel free to use whatever naming convention you like. So for example, if your wanted to create a Label for a product page you could name it “My Product Page” or “my product page” or “my-product-page”, etc…

Setting Custom Layout Widths #

When you create a Custom Label with the name starting with “Width” and then follow it with a space and then your Content, Primary Sidebar and Secondary Sidebar widths you are creating a label that can be used to force specific Layout widths when a page or post is assigned that particular label.

So for example let’s say that you have pages and/or posts with a Content/Sidebar/Sidebar layout and would like unique Content/Sidebar/Sidebar widths for that layout. In this case you could create a Custom Label with a name like this: “Width 520 220 180” (520 = Content width, 220 = Primary Sidebar width, 180 = Secondary Sidebar width). Of course the actual number values would vary, but you get the idea. And that same label would work for other double sidebar layout variants like Sidebar/Sidebar/Content or Sidebar/Content/Sidebar.

Note that if the Layouts that you will assign a particular label to are single sidebar layouts then you would only provide a width value for the Primary Sidebar like so: “Width 520 220”. And for no sidebar layouts you would only provide a width value for the Content like so: “Width 520”.

Assigning Custom Layout Widths Conditionally #

There may be cases where it would be beneficial to be able to create a Custom Label Width and then instead of assigning it to a single page or post, having it affect multiple areas of your website. To do this you would just “define” your Custom Label Width using a PHP code snippet inside a Custom Hook Box like so: <?php define( 'DYNAMIK_LABEL_WIDTH', 'label-width-700-300' ); ?>

Note that the above example would need to be tweaked to accommodate the actual Custom Label Body Class. You can find this Body Class information on each Custom Label you’ve created.

Also note that this “define” code can be easily created through the Custom PHP Builder above, using the “Label Widths” drop-down and “Define Label Width” button.

Finally in your Custom Hook Box you would select the wp_head Hook Location and then choose any Conditionals that apply. The result should be that any area on your site which is Conditionally affected by this “define” code will take on the Custom Label Width you defined.