if has theme mod

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 };

thnx

Topic get-theme-mod functions php Wordpress

Category Web


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' );

try this code:

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

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

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.