WordPress wp_title blank on index page

后端 未结 12 1079
刺人心
刺人心 2020-12-24 05:44

I\'m new to WordPress and just installed version 3.3.1.

I did some googling regarding this question and found some answers but they were relevant to version 2.7 and

12条回答
  •  忘掉有多难
    2020-12-24 06:01

    Late to the conversation...

    But if you want to use the actual title of the page that you are using for the static front page, you can use the following:

    if (is_front_page())
    {
        $title = single_post_title( '', false );
    }
    

    Although, in the actual source for wp_title(), there is the following, specificaly disabling this for the static front page:

    if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {
        $title = single_post_title( '', false );
    }
    

    I suspect there is good reason for this. So, proceed with caution.

提交回复
热议问题