Results 1 to 1 of 1

Thread: If Statements for Categories

  1. #1
    Thread Starter
    ultra's Avatar
    Join Date
    Sep 2010
    Location
    Canada
    Posts
    63
    Thanks
    2
    Thanked 1 Time in 1 Post

    If Statements for Categories

    Anyone know the exact PHP code to change loop ad listings behavior based on categories.



    Let me clarify by using the soldout ribbon I found from samcy here.

    we have this:

    PHP Code:
    <?php if (get_post_meta($post->ID'cp_ad_sold'true) == 'yes') echo '<span class="soldout-ribbon-list"></span>'; else echo ''?>
    I understand it grabs the meta data and if sold is yes it shows the ribbon.

    Lets say we want to add a facebook share button for only certain categories. But only if it is NOT sold. How do we do this? I dont know the language very well so I will explain in english.

    IF cp_ad_sold, true = no AND the category is a,b, or c than "display facebook share button"
    IF cp_ad_sold, true = yes AND the category is a,b, or c than "display soldout ribbon list"
    IF category is x,y,z than 'display another span' a
    and if its anything else do nothing?

    Let me know if you understand (hopefully) or I will try to clarify more

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Change Category Widget Show Categories and Sub Categories at all times
    By wesleyj77 in forum ClassiPress General Discussion
    Replies: 3
    Last Post: January 20th, 2014, 08:55 AM
  2. [SOLVED] Buyer can select multiple categories after payment; Using limited categories
    By ideawebdesign in forum Report Vantage Bugs (Legacy)
    Replies: 1
    Last Post: July 9th, 2013, 01:02 PM
  3. Replies: 8
    Last Post: November 28th, 2012, 12:54 PM
  4. Display User Specific Categories in CP Ad Categories Sidebar Widget
    By fuzegraphics in forum ClassiPress General Discussion
    Replies: 4
    Last Post: December 16th, 2011, 10:30 AM
  5. Child theme @import statements - remove after setup?
    By k_clark in forum ClassiPress General Discussion
    Replies: 1
    Last Post: November 3rd, 2011, 10:10 PM