I have created a custom Customizer section called checkin and with an option called title which is a text field.

I have created this function

function get_checkin_title() {
    $opts = get_theme_mod( 'checkin', array() );
  return isset($opts['title'])
            ? $opts['title']

What it does is to get the value from option title, and to return it, or if nothing is set it will return the default value. I then call this from echo $checkin_title in the frontend.

Problem is that the default value is shown on the fron-end, but in the Customizer the correct value is shown. Why doesn't this work in the front-end?

  • I have tested some more. And I can get it to work exactly as intended, but only in the Customizer area. $checkin_title = get_checkin_title(); echo $checkin_title on the template page returns the correct variables when the site is viewed from the Customizer. But as soon as I view the page in the front end I can only view the default value. – joq3 Nov 25 '18 at 11:04

Your Answer

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

Browse other questions tagged or ask your own question.