تشخیص صفحه اول در وردپرس

گاهی برای شما لازم می شود تا کد خاصی را فقط در صفحه خانه وردپرس لود کنید برای تشخیص صفحه اصلی از کد زیر استفاده کنید:

if ( is_front_page() ) :
    get_header( 'front' );
else :
    get_header();
endif;

is_front_page()
/* is_front_page() returns true if the user is on the page or page of 
posts that is set to the front page on Settings->Reading->Your homepage 
displays. */
is_home() 
/* is_home() return true when on the posts list page, 
This is usually the page that shows the latest 10 posts. */

is_home()
نظرات کاربران
ثبت نظرات
برای ثبت نظر باید عضو سایت باشید!