Register custom byline items to MD Site Design

Add new items to your post and page byline with this simple filter.

PHP HTML

Add to functions.php to register custom byline items to MD.

Click to copy
/**
 * Add new byline items for selection in MD > Site Design > Content.
 *
 * @since 1.0
 */

function child_add_byline_items( $byline ) {
	$byline['verified'] = __( 'Verified badge', 'my-child-theme' );
	return $byline;
}

add_filter( 'md_filter_byline_items', 'child_add_byline_items' );

In your child theme, create the file path: templates/byline/verified.php

Click to copy
<span class="byline-item"><?php echo md_icon( 'ok' ); ?> Verified</span>

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.

Instructions

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:

/wp-content/themes/CHILD-THEME-NAME/templates/byline/verified.php

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.

Start Building Websites That Delight

You can use the Marketers Delight WordPress Theme on unlimited sites. New features & updates are delivered to sites with your active license key.

Add to Cart
Comments (0)Forum replies (0)

No replies yet

Loading new replies...

MD.com

The Messenger

37 messages 28 likes

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

Read full article on MD.com...

Reply Like

Leave a Comment

Flash sale: Use BACKTOMD at checkout to save 5% on ANY purchase!