WordPress.org

Ready to get started?Download WordPress

Forums

Developer's Custom Fields
[resolved] slt_cf_field_value() returns nothing (2 posts)

  1. thv20
    Member
    Posted 2 years ago #

    I've defined my custom fields as per the example in the documentation, only slightly modified for my post type "Book":

    if ( function_exists( 'slt_cf_register_box') )
    	add_action( 'init', 'register_my_custom_fields' );
    
    function register_my_custom_fields() {
    	slt_cf_register_box( array(
    		'type'		=> 'post',
    		'title'		=> 'Additional info',
    		'id'		=> 'book-box',
    		'context'	=> 'normal',
    		'priority'	=> 'high',
    		'fields'	=> array(
    			array(
    				'name'			=> 'reviews',
    				'label'			=> 'Reviews',
    				'type'			=> 'wysiwyg',
    				'scope'			=> array( 'book' ),
    				'capabilities'	=> array( 'edit_posts' )
    			),
    			array(
    				'name'			=> 'extras',
    				'label'			=> 'Extras',
    				'type'			=> 'wysiwyg',
    				'scope'			=> array( 'book' ),
    				'capabilities'	=> array( 'edit_posts' )
    			)
    		)
    	));
    }

    The data is stored/updated correctly in the back-end.

    When I try to access it on the front-end, in my single view (single-book.php) it shows nothing. I'm using:
    <?php echo '<p>Reviews: ' . slt_cf_field_value( "reviews" ) . '</p>'; ?>

    Am I doing it wrong?

    http://wordpress.org/extend/plugins/developers-custom-fields/

  2. thv20
    Member
    Posted 2 years ago #

    It suddenly started working; no idea what I did wrong, probably a typo somewhere else.
    Thanks for the plug-in!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic