Support » Themes and Templates » Different ads for different categories managed by different authors

  • I am developing a WordPress theme for a large organization. It will have multiple authors who are each responsible for a different category. Additionally, they will each be responsible for ads displayed within their particular category.

    What is the easiest way to implement this. Easy for the client is more important than easy for me. Ideally, when they are logged into the admin panel, they would be shielded from any ad settings that would not be directly tied to their category.

    Any help is appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You have use

    in_category('5')
    Returns true if the current post is in the specified category id. read more
    in_category( array( 1,2,3 ) )
    Returns true if the current post is in either category 1, 2, or 3.
    !in_category( array( 4,5,6 ) )
    Returns true if the current post is NOT in either category 4, 5, or 6. Note the ! at the beginning.
    Note: Be sure to check your spelling when testing, "is" and "in" are a big difference.

    Example
    `<?php

    in_category(array( 1,2,3 )){
    echo ‘ cat1-2-3-banner ‘;
    }

    in_category(array( 4,5,6 )){
    echo ‘ cat4-5-6-banner ‘;
    }
    // this one uses page ID
    elseif in_category( array( 7,8,9 ) )
    echo ‘ cat7-8-9-banner ‘;
    }
    else {
    echo ‘ catbanner ‘;
    }
    ?>

    I have a similiar issue: My website (www.parkingandtrafficticketinfo.com) is built with the main-pages as categories. However, I’m unable to isolate an individual category to place an ad on it. Does anyone have instructions on how to place an ad on an individual category, instead of having the same ad show up on each category?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different ads for different categories managed by different authors’ is closed to new replies.