Genesis Featured Widget Amplified
Feature request: Enable custom shortcodes in post info & post meta (1 post)

  1. blogjunkie
    Posted 2 years ago #

    I wrote a custom shortcode handler to display the content of a custom field:

    add_shortcode( 'post_cf', 'click_cf_shortcode' );
    function click_cf_shortcode($atts, $content = null) {
    	global $post;
    	$defaults = array(
    			'key'    => ''
    	$atts = shortcode_atts( $defaults, $atts );
    	$custom_field = get_post_meta($post->ID, $atts[key], true);
    	if ( !$custom_field ) return;
    	$output = '<span class="post-cf post-cf-' . $atts[key] .'">' . $custom_field . '</span>';
    	return apply_filters( 'click_cf_shortcode', $output, $atts);

    So I can do this to display the content of a custom field:
    [post_cf key="custom_field_name"]

    The shortcode works in the regular Genesis Featured Post widget, but not in GFWA. I'm guessing there's a filter or something that's blocking it. I would be much obliged if you made a change to enable custom shortcodes like this. Thanks Nick :)


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Genesis Featured Widget Amplified
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic