Posts

Showing posts from April 9, 2019

WordPress Get the Page ID outside the loop

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box; } 70 19 I want to get the page ID before starting the loop in WordPress. I am using $page = get_query_var('page_id'); Apparently, it returns nothing. I just want to check a page for its ID and add a class to <body> tag based on it. php wordpress share | improve this question edited 2 days ago Maxime 5,563 1 37 47 asked Jun