Add custom items to post byline with admin controls
From MD > Site Design > Content you can control the different items that show in your post and page bylines with simple checkbox controls.
Marketers Delight supports many byline items already, such as the latest post date, post author, comments count, post category, and others.
To add your own custom byline items to byline area and accompanying admin controls for display flexibility, add the code snippets attached to this page to your functions file. See further instructions below.
In the first code snippet (see top of page) you can register your custom byline item to MD by creating a unique identifier and label. This info will be used to render the byline template and also show in the Site Design settings.
You may add as many custom byline items as you’d like here.
Once done, save your functions file and MD will now recognize your new byline item(s). To confirm this, go to WP admin > MD > Site Design > Content and verify that your new byline item is selectable.
The new byline item will not be visible unless enabled through these settings, so enable the new checkbox setting and save for it to appear in the corresponding byline area.
The final step is to create the markup to show when your custom byline is enabled. To do so, make sure you have a child theme activated.
In your child theme, create the following folder directory with the unique identifier as the template file name you setup in your functions file. This example created the Verified badge byline item, so the file path will look like:
Here is some example markup you can paste into the file:
<span class="byline-item"><?php echo md_icon( 'ok' ); ?> Verified</span>
There are no real restrictions on the markup you can use for your custom byline item, but be sure to design something uniform that blends in with your site’s design for best readability.
Loading new replies...