• Good afternoon, i am having a big trouble on solving this issue.
    I want to access the php code and BEFORE the page is displayed, i want to get the $_GET parameter and access the Database to check the page_id for that parameter.
    For instance: /wordpress?paramenter=sitename and in my DB i can relate that sitename to a page_id.
    Is it possible? Pleaaase ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Where would sitename and its relation to a page ID be stored in the database?

    For example, you could have a Custom Field called ‘sitename’ with the value of the actual site name, attached to the proper page/post.

    Then you could use a WP_Query on meta_key => ‘sitename’ and meta_value => $sitename to return the page/post. Something like this (not an example of bulletproof code!):

    $sitename = $_GET['parameter'];
    $args = array(
       'posts_per_page' => 1,
       'ignore_sticky_posts' => 1,
       'meta_key' => 'sitename',
       'meta_value' => $sitename,
    );
    $my_post = new WP_Query($args);
    Thread Starter diogomend

    (@diogomend)

    Hello vtxyzzy,
    that should do it, but where do I put that piece of code? In the templateloader.php? I think that is the file responsible to get the page content

    Where you put the code depends totally on your theme.

    If you are using a free theme, post a link here to its download page so the code can be examined. If you are using a paid theme, you should contact the theme supplier.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get page content manually’ is closed to new replies.