Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Ok I'm creating a site for a company, this company will have multiple users. In the footer I am trying to include the company name, phone and address but not as a widget. I need to store the information in a place where all users can edit it.

In the past I've stored this kind of information in a users profile but that is only good on a single user blog.

Where can I store this information where I can easily pick it up in the theme and all users can see/edit it.

share|improve this question

2 Answers 2

Create an Option Page and name it something like "Adress". In Google you will find a lot about Option Pages. For this small Settings, i would not recommend to use a option-framework.

Some Links: Nettuts or 12 how to's.

share|improve this answer
    
manage_options normally is a cap only assigned to admins... –  kaiser Nov 13 '12 at 11:57
    
@kaiser then give non admins also the rights. Easly made through the User Role Editor. –  mnewmedia Nov 13 '12 at 12:44
2  
@mnewmedia - I think the point is that you might not want to give all company users that permission. Otherwise they can access all options, and install & activate plugins. –  Stephen Harris Nov 13 '12 at 12:54
2  
@mnewmedia manage_options is like a AAA-pass. You surely don't want to give any user this capability. –  kaiser Nov 13 '12 at 13:00
    
@kaiser maybe not the right for manage_options but the right to edit the Options Page -> for me it works great –  mnewmedia Nov 13 '12 at 13:02

This is direct copy and paste from my functions.php using the prefix rl.

Hope this helps you. You can just do a if current_user_can if you want only admins to see this field and if true run rl_register_settings_area().

/**
 * Adds a settings section to general settings in WordPress admin.
 * @return null
 */
function rl_register_settings_area() {

    add_settings_section( 'rl_settings_section', get_bloginfo( 'name' ) . ' Settings', 'rl_setting_prepended_text', 'general');

    add_settings_field( 'rl_setting_address1', 'Address', 'rl_create_settings_field', 'general', 'rl_settings_section' );

    register_setting( 'general', 'rl_setting_address1' );
    register_setting( 'general', 'rl_setting_address2' );
    register_setting( 'general', 'rl_setting_address3' );
    register_setting( 'general', 'rl_setting_address4' );
    register_setting( 'general', 'rl_setting_address5' );

}

add_action( 'admin_menu', 'rl_register_settings_area' );


function rl_create_settings_field() {
    ?> 
    <form>
        <input name="rl_setting_address1" type="text" value="<?php echo get_option('rl_setting_address1'); ?>" class="code"  /> <br />
        <input name="rl_setting_address2" type="text" value="<?php echo get_option('rl_setting_address2'); ?>" class="code"  /> <br />
        <input name="rl_setting_address3" type="text" value="<?php echo get_option('rl_setting_address3'); ?>" class="code"  /> <br />
        <input name="rl_setting_address4" type="text" value="<?php echo get_option('rl_setting_address4'); ?>" class="code"  /> <br />
        <input name="rl_setting_address5" type="text" value="<?php echo get_option('rl_setting_address5'); ?>" class="code"  /> <br />
    </form>
    <?php

}

function rl_setting_prepended_text() {

    echo 'Change address of your company';

}
share|improve this answer
    
I accept that this might not be the best way to do it. –  Owain Cuvelier Nov 13 '12 at 16:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.