I wanted to create a custom widget for every post.
So I add to the function.php this code
add_filter( 'widget_text', 'do_shortcode' );
add_shortcode( 'mytext', 'so_13735174_custom_text_widget' );
function so_13735174_custom_text_widget( $atts, $content = null )
// $post contains lots of info
// Using $post->ID many more can be retrieved
// Here, we are getting the Custom Field named "text"
$html = get_post_meta( $post->ID, 'text', true );
// Custom Field not set or empty, print nothing
if( !isset( $html ) || '' == $html )
// Print Custom Field
And then add text widget with shortcode [mytext]
Everything work perfect, but I wanted to add Filed Type:”Relationship” to show posts with thumbnail on different posts and pages.
But it only displays “Array”.
I am not a programer and any help will be appreciate it. Thanks.
Viewing 1 post (of 1 total)
The forum ‘Back End’ is closed to new topics and replies.