custom 404 messages depending on path?
-
I would like to have several different 404 error messages that display according to the url path they appear in.
For example, here is a search for recipes that returns no posts:
http://protogeo.info/wordpress_v2/recetas/resultados?prod=37
I would like to change the error message to something more specific, and assumed I could do this by using conditional tags in my 404.php file, like this:<?php if is_page_template('page-recipe-results.php') { _e('No recipes match that category.','k2_domain');</p> } else { _e('Oh no! You\'re looking for something which just isn\'t here!','k2_domain');</p> } ?>However, that didn’t work. I also considered that I might parse the directory from the URL path so that any 404 pages preceded by “http://protogeo.info/wordpress_v2/recetas/resultados” would return the recipe-specific statement, yet I couldn’t get any value using $_SERVER[‘PHP-SELF’].
Maybe there’s a better approach I’m missing?
The topic ‘custom 404 messages depending on path?’ is closed to new replies.