开发者

Detect the browsed page from url in wordpress

开发者 https://www.devze.com 2023-02-10 14:25 出处:网络
I have underlined and italicized the post titles in homepage via jquery. I have written the jquery code in footer. The header and footer are commonly called in all inside pages and homepage as well. S

I have underlined and italicized the post titles in homepage via jquery. I have written the jquery code in footer. The header and footer are commonly called in all inside pages and homepage as well. So when I click on the post titles in the homepage, the single post page is browsed but I can still see the same style for the post title like in the homepage. I need to detect the page through url as i have se开发者_高级运维t the url pattern to %post_name% in the admin panel. Moreover I have to place a condition to detect the pages. If it is the homepage I have to enable the code else nothing.

Please help me with this.


Just add a simple:

if (is_front_page()) { do this }
else { do that }

A little bit more about conditional wordpress tags: http://codex.wordpress.org/Conditional_Tags


wp_list_pages function should get you what you're looking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号