With your WordPress Blog design, at least for the Twenty Ten theme we use at this blog, in the code you can differentiate between a “Landing Page” type of call and other types of calls, to specific posts or tags or categories or searches or administrative calls, by the existence of “get” parameters so that …
- in PHP (eg. header.php) you can check
if (strlen($_SERVER['QUERY_STRING']) > 0) { echo "Not on Landing Page"; } else { echo "On Landing Page"; }
- in HTML/Javascript (eg. still the logic in header.php) you can (Javascript DOM) check
if (document.URL.indexOf("?") != -1) { alert("Not on Landing Page"); } else { alert("On Landing Page"); }
… and it just so happens with our blog, we have a “Sticky” posting (above the fold) for the “Landing Page” scenario, so we don’t have to make the changes in header.php this time (but rather use the CMS HTML code of the blog posting to make the changes needed today) … and it just so happens you can add Javascript logic to an individual posting … and it just so happens we’ve discussed this as well at Javascript in Your WordPress Post Primer Tutorial should you be curious.
And so what? What’s the point? Well, the personal point is, that we would like, for the “Landing Page” scenario only (because if they come another way they probably already know), to inform the user, maybe not straight away, but soon, that they have landed at an I.T. blog, because it may be their first visit, and you have to look around to find this out for sure (“in the old days”) … actually don’t mind the idea of users taking time to find something out, but not if it means you score a “bounce” (ie. the user immediately leaves your website).
There is a small danger of annoyance with the dynamic scenario, for some users, but tend to think this resistance to dynamically changing websites represent users who probably will not like this blog much anyway.
So you can see the “Landing Page” blog posting HTML (in isolation) as post_316.html which changed as per post_316.html.
Hope you enjoy today’s WordPress specific tutorial.
If this was interesting you may be interested in this too.