WordPress.org

Ready to get started?Download WordPress

Forums

Jerome's Keywords - condition tag, how? (10 posts)

  1. makwak
    Member
    Posted 7 years ago #

    elseif(is_tag('mykeyword')) { some stuff here }
    At the top of the searchpage for a keyword, using Jerome's Keyword plugin, I want to add some content, but what is the correct conditional tag? (Obviously is_tag doesnt exist).

    Where the tag page would be like: http://mydomain.com/tag/mykeyword

    Probably a simple answer! Thanks.

  2. Evita
    Member
    Posted 7 years ago #

    Oh my good, I hate my bad English - hope you can understand my posting.
    In my opinion, conditional tags works only for wordpress "stuff" and not for plugins. So if you want to display some content for the keyword you only can do it if you exclude all your other sites, e.g.

    if is_home, is_category, is_page, is_single, is_search, is_error404, is_day, is_month, is_year
    //do nothing //
    else
    // this is my keyword-text

    It works for me, but maybe there is a simpler way.

  3. Chris_K
    Member
    Posted 7 years ago #

    After doing a search on a tag, what's the querystring for that resulting page?

    Is it like any other WP Search where "s" has the searched for value? If so, just grab it out of the query string and run with it.

  4. makwak
    Member
    Posted 7 years ago #

    ok, what do I run with!
    In actuality, the query is like:
    http://mydomain.com/index.php?tag=mykeyword

    so what do I put:
    elseif(is('index.php?tag=mykeyword')) { some stuff here }

    or?

  5. makwak
    Member
    Posted 7 years ago #

    ok I am dumb.
    elseif('index.php?tag=mykeyword') { some stuff here}

    works lovely.

  6. makwak
    Member
    Posted 7 years ago #

    No I was wrong, the above also works for all keywords, not just a single specific one. So is there anything out there that explains this?
    Thanks.

  7. Chris_K
    Member
    Posted 7 years ago #

    My PHP-fu is weak... but you want to get the value of the query string variable "tag" and use that in your compares.

  8. Kafkaesqui

    Posted 7 years ago #

    elseif( isset($_GET['tag']) && ('mykeyword' == $_GET['tag']) )

    http://php.net/manual/en/reserved.variables.php#reserved.variables.get
    http://php.net/isset

  9. Chris_K
    Member
    Posted 7 years ago #

    Thank you Kafkaesqui.

  10. makwak
    Member
    Posted 7 years ago #

    Well once again I am lost. Here is what I tried:
    http://www.mw2mw.com/marek/temp/conditional.txt
    using Kafkaesui's code...
    when I tried it here:
    http://mw2mw.com/tag/installation
    I don't get the content at the top, which I do get for categories...

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic