Use Settings Page for Site Title?

Support MB Settings Page Use Settings Page for Site Title?Resolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #30957
    Thomas PinkusThomas Pinkus
    Participant

    Wondering if its possible to use the Settings Page w/ Custom Fields to populate the site title? The goal is to keep my clients out of the WP standard settings area but and build the Site Title from a few different entries in teh MB Settings Page.

    Thx

    #30966
    Long NguyenLong Nguyen
    Moderator

    Hi Thomas,

    Yes, it is possible. But you need to use the code to output the field value to the area where you show the site title.

    Please read more on the documentation https://docs.metabox.io/extensions/mb-settings-page/#getting-field-value

    #32287
    info@ceescoenen.nl[email protected]
    Participant

    Hi Long, can you please tell me more how to do this?

    #32307
    Long NguyenLong Nguyen
    Moderator

    Hi Cees,

    I think it's not hard to do. You can find the code that displays the site title in your code (or theme code) and replace it with the helper function rwmb_meta(). Here is an example https://stackoverflow.com/questions/18686523/display-wordpress-site-title

    #42027
    UnakritiUnakriti
    Participant

    Its an old thread but thanks @Long Nguyen. I found a solution that works for me. I am sharing a snippet (inserted on admin_init) below in case anyone else is interested.

    <?php
    $value_title = rwmb_meta( 'custom_field_site_title', [ 'object_type' => 'setting' ], 'site-options' );
    $value_tag = rwmb_meta( 'custom_field_tagline', [ 'object_type' => 'setting' ], 'site-options' );
    update_option('blogname', $value_title);
    update_option('blogdescription', $value_tag);

    The snippet updates the options in database whenever the custom fields on the Settings Page are edited.

    Kind regards,

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.