2015-06-12 29 views
-1

不知道如何寫包含在此聲明is_home()如何寫is_home功能的WordPress

if (function_exists('ditty_news_ticker')){ 
    ditty_news_ticker(47); 
} 

我已經嘗試了幾種不同的方式,但我一直打破它。我確定有一個非常簡單的解決方案,但我對PHP很適應。

+0

試試這個'如果(is_home()&& function_exists( 'ditty_news_ticker')){ditty_news_ticker(47);}' – Samir

+0

其實,is_home()似乎並沒有工作,所以我去了is_front_page()而不是 - 但是我需要什麼 - 謝謝! –

+0

在wp'is_home()'表示博客首頁NOT網站首頁。你真的想要哪個頁面? '首頁'還是'博客主頁'? – Samir

回答

0

啊,我想通了:

if (function_exists('ditty_news_ticker') && is_front_page()){ditty_news_ticker(47);} 
1
if (function_exists('ditty_news_ticker') && is_home()){ ditty_news_ticker(47); }