Does someone know how to write the next line in wordpress PHP, because i'm not that great with PHP.

If_theme_mode has content echo { my content } else { other content };



try this code:

if( get_theme_mod('your_setting_name') ){
  //your code
  //your code

Note: get_theme_mod() return false if no value exist for your setting


You can check for a theme mod, echo it if it exists, or apply a default if not, all with one line:

echo get_theme_mod( 'example', 'Some default' );

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.