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 the homepage as a static page in the backend, we can only use the is_front_page function to check if it's the homepage.
References
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.