• Resolved stinker

    (@stinker)


    Here’s my custom query…

    ?page_id=44&myparam=android

    How can I grab the “myparam=android” and then use it as the condition of the following example?

    <?php if ( is_category ( ‘android’ ) ) ) : ?>
    <?php include(TEMPLATEPATH.’/header-android.php’); ?>
    <?php endif; ?>

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Looks like you are need to take a look at $_GET. Use this as an example: https://www.w3schools.com/PHP/php_get.asp.

    With your example – if you echo $_GET[“myparam”], you would get “android” so you could use that conditionally.

    Thread Starter stinker

    (@stinker)

    Any thoughts on how I might use $_GET["myparam"] instead of is_category in the above conditional statement?

    Would it be something like?…

    <?php if $_GET[“myparam”] == “android” ?>

    My PHP skills are feeble. ??

    Thread Starter stinker

    (@stinker)

    Rather than use a conditional statement, I opted for the following…

    <?php include(TEMPLATEPATH.'/header-' . $_GET["myparam"] . '.php'); ?>

    Thanks for the help, jenz.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to grab custom query parameter?’ is closed to new replies.