The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Load PHP file if parent and child of parent

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #44541

    I am building a website in WordPress and have a set of photos that display along the top of the page (in the background) and have them to where the set of photos can change depending on where the visitor is on the website. For example, if they are looking at the FAQ page, then photos pertaining to asking questions are shown. If they are looking at the news page, then photos pertaining to news are shown. The code I have works great, however, I’d like to now show photos based on a specific parent and any children of the parent.

    Here’s my code as it stands now:


    How can I tell WordPress, I want it to show a certain php file if it is a parent page and all of it’s children?


    Not a wordpress user , but I do way too much PHP [probably need a 12 step program by now] :)
    depending on exactly what you want and how wordpress is actually laid out , one might find the
    get_included_files function useful as it maintains a list of all the files involved in the production of any page. Then one could have some simple XML ,JSON, or even plain old text file where you could store your rules that could be read in to decide when and where to include content.

    Another possibility that might be easier is some sort of .htaccess mod-rewrite rule that you could set in any directory you liked that could add something to the url so you would only have to check for one thing in the PHP but otherwise not have to fiddle with the PHP scripts after the one time.

    Generally I try in my PHP projects to generify and externalize things so I don’t have to be editing PHP files. To many other aspects of development that are much more fun.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.