WordPress.org

Ready to get started?Download WordPress

Forums

Help with a custom PHP script / wordpress (1 post)

  1. bigbrennan
    Member
    Posted 6 years ago #

    Hi guys,

    We have created a small PHP script which will load a particular image dependent on which category the blog is posted in.

    On our website index (index.php) we have the following codes:

    Header:

    <?php
    
    require('blog/wp-blog-header.php');
    
    ?>

    Body:

    <?php
    
    if(get_the_category_list(', ')=="john-virgo")
    {
        ?>
                                  <img src="images/top5.jpg" width="100" height="100" alt="" />
                                  <?php
    }
    elseif(get_the_category_list(', ')=="something")
    {
        ?>
                                  <img src="image2.jpg" width="100" height="100" alt="" />
                                  <?php
    }
    
    ?>

    But this is not working correctly.

    If I set the criteria to be 'uncategorized' then it will load the image, but any other category title and it won't.

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic