Site Title and Tagline in Pagelines DMS Options Panel

I’m using the Pagelines DMS Theme and I’m wanting to extend the functionality of the front end admin panel. The user(s) I’m building this for would like to be able to edit a few settings directly from this page, including of which – the Site Title and Tagline.

Concept:
enter image description here

add_filter('pl_sorted_settings_array', 'add_global_panel2');
function add_global_panel2($settings){
$settings['privacy'] = array(
    'name' => 'Blog Name',
    'icon' => 'icon-eye-open',
    'opts' => array(
        // Regular Options Engine
        array(
        'id' => 'blogname',
    'type' => 'text',
           'label' => __('blog Name', 'pagelines')
    ),
        // Regular Options Engine
        array(
        'id' => 'blogdescription',
    'type' => 'text',
           'label' => __('blog description![enter image description here][1], 'pagelines')
        ),
    )
);
// Finally we return the new array
return $settings;
}

Is there a way to do this (add their own Site Title and Taglines) within a text-field for example, click Publish Options button to output it to the front-end of the site and display an updated version in the WP API Settings > General Settings sub-menu page?

1 Answer
1

Ok,

So I have found a solution to my problem;

Pagelines encodes each key and value pair into a json string, within in its own option called pl_settings in the wp_options table.

They also give you access to each of these key->value pairs using the following:
$value = pl_setting(‘option_key’)

Thus I have taken the approach of using the following code to fulfil my needs:

add_filter('pl_sorted_settings_array', 'add_global_panel2');
function add_global_panel2($settings){
    $settings['privacy'] = array(
        'name' => 'About Your Loved One',
        'icon' => 'icon-heart',
        'opts' => array(
            // Regular Options Engine
        array(
                'key' => 'blogname',
                'type' => 'text',
                'label' => 'the name of your loved one',
                'help' => 'test'
        ),
            // Regular Options Engine
            array(
                'key'   => 'blogdescription',
                'type' => 'text',
                'label' => 'a message to your loved one',
                'help' => 'test'
            ),
        )
    );
    update_option('blogname', $value = pl_setting('blogname'));
    update_option('blogdescription', $value = pl_setting('blogdescription'));
    // Finally we return the new array
    return $settings;
}

The only downside of working it in this way is that I need to refresh the browser twice once updating either of the values for it to actually take effect on it’s corresponding option.

If anyone could better this then please let me know.

Leave a Comment