• Resolved erniebornheimer

    (@erniebornheimer)


    Hi

    I have a set of related pages. They each need to pull data from the database, but slightly different SQL query, depending on the page. I’ve created a template for these pages, and it works fine.

    Is the page slug or title in a variable that I can use in the page template? I’m picturing something like:

    – if $page = $such-and-such, run SQL_query_x
    – elseif $page = $so-and-so, run SQL_query_y

    I should mention I’ve looked at plugins to get this functionality, but for one reason and another, plugins are not the way to go for me at this time, and I want to try something else. Can it be done? How can I get to which page is being loaded?

    Thank you!

    Ernie Bornheimer

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘custom PHP in page.php’ is closed to new replies.