Most websites only display blogroll links on the homepage, not on inner pages. Normally, we can use<?php if (is_home ()&&!is_paged() ) : ?>to check if it's the homepage. However, if a static page is set as the homepage, this check will fail. We can use the following method to determine it.
<?php if ( is_front_page() ) { ?>
要显示的内容或者代码
<?php } ?>The normal homepage call code is:
<?php if (is_home ()&&!is_paged() ) : ?> 要显示的内容或者代码 <?php endif; ?>
You can see two code checks: one is is_front_page, and the other is is_home.
When we set a static page as the homepage in the backend, we can only use the is_front_page function to determine if it's the homepage.
References