APF_PostType::content PHP Метод

content() публичный Метод

This method is called in the single page of this class post type. Alternatively, you may use the 'content_{instantiated class name}' method,
public content ( $sContent )
    public function content($sContent)
    {
        // 1. To retrieve the meta box data - get_post_meta( $post->ID ) will return an array of all the meta field values.
        // or if you know the field id of the value you want, you can do $value = get_post_meta( $post->ID, $field_id, true );
        $_iPostID = $GLOBALS['post']->ID;
        $_aPostData = array();
        foreach ((array) get_post_custom_keys($_iPostID) as $_sKey) {
            // This way, array will be unserialized; easier to view.
            $_aPostData[$_sKey] = get_post_meta($_iPostID, $_sKey, true);
        }
        // Or you may do this but the nested elements will be a serialized array.
        // $_aPostData = get_post_custom( $_iPostID ) ;
        // 2. To retrieve the saved options in the setting pages created by the framework - use the get_option() function.
        // The key name is the class name by default. The key can be changed by passing an arbitrary string
        // to the first parameter of the constructor of the AdminPageFramework class.
        $_aSavedOptions = get_option('APF_Demo');
        return "<h3>" . __('Saved Meta Field Values of the Post', 'admin-page-framework-loader') . "</h3>" . $this->oDebug->get($_aPostData) . "<h3>" . __('Saved Setting Options of The Loader Plugin', 'admin-page-framework-loader') . "</h3>" . $this->oDebug->get($_aSavedOptions);
    }