• In my admin, i have a custom option that allows a user to add their twitter and facebook name. It saves it perfectly. I can’t for the life of me figure out how to display the twitter and facebook entry on the front end in an insertFootNote function that displays html beneath each post. Can anyone help?

    My Registered Settings portion of the admin that saves the data:

    register_setting(
                'mp_option_group', // Option group
                'mp_options', // Option name
                array( $this, 'sanitize' ) // Sanitize
            );
    
            add_settings_section(
                'setting_section_id', // ID
                'Link your social accounts', // Title
                array( $this, 'print_section_info' ), // Callback
                'my-setting-admin' // Page
            );  
    
            add_settings_field(
                'twitter', // ID
                'Twitter Name', // Title
                array( $this, 'twitter_callback' ), // Callback
                'my-setting-admin', // Page
                'setting_section_id' // Section
            );      
    
            add_settings_field(
                'facebook',
                'Facebook Name',
                array( $this, 'facebook_callback' ),
                'my-setting-admin',
                'setting_section_id'
            );

    and the output:

    global $mp_option_group;
    foreach ($mp_options as $value) {
        if (get_option($value['id']) === FALSE) {
            $$value['id'] = $value['std'];
        }
        else {
            $$value['id'] = get_option( $value['id'] );
        }
    }
    function insertFootNote($content) {'
    <p>Hello ' . $facebook . '
    ';
    }
  • The topic ‘How To Get Custom Options and Display in HTML’ is closed to new replies.