WordPress page_id in a loop – not working with enhanced permalinks
-
Hello everyone, I am having a little problem with a list of links to wordpress pages. This is what I am trying to implement:
<?php if ($page_id == ‘2’) {echo “
<li class=\”current\”>Profile
“;}
else {echo “- Profile
“;} ?>
To put it simple it is supposed to be a system printing different text depending on the current page id. That way I can give a .current class to a li element, like I do in the example. It always worked flawlessly until the moment I activated a different kind of permalinks to have a more user friendly URL for the blog pages. I do not know wordpress in depth and I did not find enough informations on the matter around the web. Would anybody mind giving me a couple of things on how to solve this problem, maybe a workaround or a easier system ro recognize the page I am in in wordpress and how to use it in a php loop?
Thanks everyone.
- The topic ‘WordPress page_id in a loop – not working with enhanced permalinks’ is closed to new replies.