×

Notice

The forum is in read only mode.

How do you use an if/else statement with the_category (categories, WordPress)?

More
3 months 2 weeks ago #2224 by Elias Katsaniotis,MSc
How do you use an if/else statement with the_category (categories, WordPress)?
More
3 months 2 weeks ago - 3 months 2 weeks ago #2225 by Elias Katsaniotis,MSc
use is_category()   see
 is_category() | Function | WordPress Developer Resources

 Determines whether the query is for an existing category archive page.

  developer.wordpress.org/reference/functions/is_category/

 also see

 Constructing An if Statement with is_category(); in archive.php (WordPress)
 I am trying to use an if statement with is_category() in order to build a bigger piece of code later. I can't get the code to recognize the if statement though. Basically below I've posted the coding
  stackoverflow.com/questions/11659177/con...rchive-php-wordpress
  • if(is_category()) { 
  • echo "category!"; 
    also see
    the_category if/else statementI need to do the following: The sense if I have a class dportfolio - show a category dportfolio. Otherwise show usual category. I use: if ( class_exists( 'DPortfolio' ) ) { echo DPortfolio::

    wordpress.stackexchange.com/questions/16...ry-if-else-statement


    I need to do the following: The sense if I have a class dportfolio - show a category dportfolio. Otherwise show usual category.I use: 
    • if ( class_exists( 'DPortfolio' ) ) { 
    • echo DPortfolio::instance()->dportfolio_get_category(); 
    • }; ?> 
    Last edit: 3 months 2 weeks ago by Elias Katsaniotis,MSc.
    Time to create page: 0.110 seconds

    Site Info

    V. Katsanioti,

    Russia,

    Kaliningrad Oblast.

    matizegr@yahoo.com

    Visit counter

    United States of America (the) 80.5% United States of America (the)
    Russian Federation (the) 11.1% Russian Federation (the)
    China 5.1% China

    Total:

    34

    Countries
    00001879
    Today: 16
    Yesterday: 33
    This Week: 104
    Last Week: 565
    This Month: 1,799
    Last Month: 81

    Who's Online

    We have 438 guests and no members online