1

I am having trouble with my customize field in WordPress. The field shows up fine in the customize section of WP but it just does not echo out.

<p> <?php echo get_theme_mod('copyright_details'); ?> </p>

functions.php code:

function limus_customize_register( $wp_customize )
{
   //copyright
    $wp_customize->add_section('limus_copyright', array(
        'title' => __('Copyright Details', 'limus'),
        'description' => 'Add/Edit copyright information'
    ));
    $wp_customize->add_setting('copyright_details', array(
        'default' => '&copy; 2000-2013 Limus Design Inc. All Rights Reserved.'
    ));
    $wp_customize->add_control('copyright_details', array(
        'label' => __('Copyright Information', 'limus'),
        'section' => 'limus_copyright',
        'setting' => 'copyright_details'
    ));
}
add_action( 'customize_register', 'limus_customize_register' );
6
  • I've run your code seems to work fine. Have you tried enabling debug? Aug 22, 2013 at 21:02
  • I have enabled debug from wp-config.php but I see no errors...
    – Shivam
    Aug 22, 2013 at 21:16
  • Ah I see what was happening for me it only shows up when your viewing the site via /wp-admin/customize.php Aug 22, 2013 at 21:28
  • Yes, I mentioned that in the post. Just the output is not coming out...
    – Shivam
    Aug 22, 2013 at 21:35
  • 2
    Have you saved it, know that sounds obvious but the default values are only place holders, won't actually load till you've altered and saved them. Just tried that and seems to be working now Aug 22, 2013 at 21:37

1 Answer 1

2

If get_theme_mod() is loading in the customize section, but not on site, it's probably because you haven't saved and published the field. Try altering a field and clicking 'Save & Publish'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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