Add Link In Genesis Entry Meta

The 1st code snippet in this tutorial creates a new shortcode which enables you to add a link to the entry meta in the entry footer. In this case, it adds a link for a disclosure policy.

Once you create the shortcode, you can then add it using the genesis_post_meta filter hook which adds it to the post meta in the entry footer. You can add the shortcode before or after the categories and tags.

Add the following code to your child themes functions file.

add_shortcode( 'disclosure', 'genesis_disclosure_link_shortcode' );

function genesis_disclosure_link_shortcode( $atts ) {

    $link = sprintf( '<a href="%s">%s</a>', esc_url( 'http://example.com/' ), 'Disclosure Policy' );

	$defaults = array(
		'after'  => '',
		'before' => __( 'FTC Compliance: ', 'genesis' ),
		'link'   => $link,
	);

	$atts = shortcode_atts( $defaults, $atts, 'disclosure' );

	$output = sprintf( '<span %s>', genesis_attr( 'disclosure-policy' ) ) . $atts['before'] . $atts['link'] . $atts['after'] . '</span>';

	return $output;

}

Also add the following code:

If you want to add a link in the entry meta ( post info ) in the entry header on single posts, use the following code:

Here’s one example:

You could also add it using the shortcode with the genesis_post_info filter function.

Related Tutorials

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.