WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] PHP Coding help (5 posts)

  1. beisbolct
    Member
    Posted 4 years ago #

    I need some help with a php code.

    I have an advertiser who wants to run an ad on both the homepage and a single page. How do i go about doing this?

    I currently have two ads that just run on homepage only. I need to make another ad appear on the home page and the 2009 red sox schedule page.

    <?php if ( is_home() )  { ?>
    <?php } ?>

    is what I have for the homepage only ads. The page slug for the one to be added is 2009-boston-red-sox-schedule

    If anyone can help me with this i'd really appreciate it. Every time I try, I keep messing it up.

    My site is http://soxanddawgs.com

  2. Shane G
    Member
    Posted 4 years ago #

    Hi,

    In the sidebar [seidebar.php] or header [header.php] you can add the advertisement code..so you can view the advertisement on each pages..

    while to add the advertisement on specific page you need to do hard code and add it in the page from wordpress admin area page writing section..

    Thanks,

    Shane G.

  3. Xamataca
    Member
    Posted 4 years ago #

    <?php if ( is_home() || is_page(x) )  { ?>
    stuff here
    <?php } ?>

    This shows the stuff either if is homepage or that page(x). Where X is the number of your page ID
    If you want to show that stuff in more pages:

    <?php if ( is_home() || is_page(array(x,y,z)) )  { ?>
    stuff here
    <?php } ?>

    If you want it in a category too:

    <?php if ( is_home() || is_page/(array(x,y,z)) || is_category(x) )  { ?>
    stuff here
    <?php } ?>

    More on the codex:
    http://codex.wordpress.org/Conditional_Tags

  4. beisbolct
    Member
    Posted 4 years ago #

    Thanks Xamataca.

    When I was looking at it, i couldn't figure out the proper language at the top with the page. I'll try it out in a bit.

  5. beisbolct
    Member
    Posted 4 years ago #

    Thanks again,

    It worked perfectly. My problems stemmed from what to put after the home between them.

Topic Closed

This topic has been closed to new replies.

About this Topic