WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pass Category Name to a variable... (4 posts)

  1. kogeorge75
    Member
    Posted 8 years ago #

    I don't know anything about PHP and I want to thank whomever it is good enough to help me right now. So, bam- thank you. I am so frustrated...

    I am using the TriColumn theme at [mod: link removed, spammy seo site]

    A friend of mine used to have a company by that name, but he switched...and gave me the domain to play with. But I digress...

    It seems that in the index.php (and everywhere else) it calls the category name with the following code:

    <?php the_category(', ') ?>

    However, that code is automatically a hyperlink. So, if the Category was Arizona, Arizona would be clickable anywhere that I used <?php the_category(', ') ?>

    So... I dont know PHP, but this is what I essentially want to do:

    set myCAT = <?php the_category(', ') ?>
    myCAT = some kind of get-rid-of-hyperlink function
    Display: You are viewing the myCAT category.

    And, where the variable myCAT is- there is no hyperlink.

    Or, maybe this whole email was for naught and there is already a built in way to call up your category? Is it template related?

    Thank you so much.

  2. moshu
    Member
    Posted 8 years ago #

    You may want to read about this tag Template_Tags/get_the_category

  3. MattRead
    Member
    Posted 8 years ago #

    Try using get_the_category()

    ------------------------------
    [moderated: no sigs plz]

  4. kogeorge75
    Member
    Posted 8 years ago #

    Thanks to both of you! Especially you Moshu- that post helped... I could have found that myself, but the WordPress support search is misbehaving?

    Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic