Purchase OIOpublisher now for just $47.

Take control of your ad space.

Click here to purchase

  1.  

    Have read all of the previous posts referencing subid to control which ads display on which pages - BUT have not be able to accomplish the desired effect.

    Goal: To display specific ads on specifc pages (using Wordpress default template - page.php) in Wordpress 4.2.3.

    Have installed OIO Publisher and created a number of ads through Purchaser interface and assigned them to Category (Shop, Dine, Stay, Play, Services) with corresponding subid of the Wordpress generated code (i.e. page-id-10). So have 4 ads that should display on the Shop page. Have 1 ad that should display on the Dine page. Have 1 ad that should display on the Stay page etc.

    With specific reference to http://forum.oiopublisher.com/discussion/2468/subid-question/#Item_0

    Have installed "Enhanced Text Widget" to enable use of PHP in sidebar widget and using the following code that PHP-friendly widget:

    <?php
    global $wp_query;
    $subid = $wp_query->queried_object->post_name;
    ?>

    <script type="text/javascript" src="http://grainsofsand.ca/wp-content/plugins/oiopub-direct/js.php#type=banner&align=center&zone=1&shuffle=true&refresh=1&repeats=true&subid=<?php echo $subid; ?>"></script>

    However this is not working.

    Can you please advise what this code should look like to achieve desired goal?

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeJul 26th 2015
     
    Project Admin

    The URL parameter in the javascript URL should subID (raher than subid), so that might be the cause of the issue.

    If the subID was 'page-id-10' and that exact string was in the javascript url (e.g. &subID=page-id-10) and also set against the purchased ad in the admin area, then it should filter on that subID and only show ads matching it (it also shows ads with no subID set, since it assumes they are "global").

    Need help?  Quick start guide | Troubleshooting | All help topics
  2.  

    Sorry - but this still is not working for me. It could be I misunderstand.

    I'm trying to ensure that ONLY the shop ads show up on the Shop page and ONLY the dine ad shows up on the Dine page etc.

    My understanding of this PHP and Javascript combination was that the query would call the page ID and then that was echoed into the Javascript line which then would only show the appropriate ads on the page.

    Thus enabling ONE widget to drive the shop ads to the shop page, the dine ads to the dine page, the stay ads to the stay page etc.

    For the record, here are my page IDs:
    Shop page-id-10
    Stay page-id-4
    Play page-id-6
    Dine page-id-8
    Services page-id-12

    Each ad created through the OIO Publisher interface has been assigned to a Category (i.e. Shop, Stay, Play, Dine, Services - which are the actual names of the pages and displays in the page URL) but also to the subID.

    I have corrected the code to use "subID" - here it is:
    <?php
    global $wp_query;
    $subID = $wp_query->queried_object->post_name;
    ?>

    <script type="text/javascript" src="http://grainsofsand.ca/wp-content/plugins/oiopub-direct/js.php#type=banner&align=center&zone=1&shuffle=true&refresh=1&repeats=true&subId=<?php echo $subID; ?>"></script>

    Still not working. I am not a PHP or Javascript coder - is there something about the code I'm using that is not correct syntax?

    I've attached a PDF of a screenshot of one of the created ads admin area showing the assignment of the ad to the subID.

    I'd be happy to provide a temporary admin account is you think this is something in our settings etc.

    We're setting up on a test site right now before taking it over into the live site.

    Need help?  Quick start guide | Troubleshooting | All help topics
  3.  

    FINALLY GOT IT WORKING WITH THE FOLLOWING CODE:

    <?php
    global $post;
    ?>
    <script type="text/javascript" src="http://grainsofsand.ca/wp-content/plugins/oiopub-direct/js.php#type=banner&align=center&zone=1&shuffle=true&refresh=1&repeats=true&subID=page-id-<?php echo $post->ID; ?>"></script>

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeAug 2nd 2015
     
    Project Admin

    Aha, great news. :)

    Need help?  Quick start guide | Troubleshooting | All help topics
  4.  

    Hi Simon - a related question.....

    Have an ad I'd like to display across all pages - but unable to make that happen with the setup we've put in to control ad by page id.

    I've tried entering the page ids into the admin area for that ad leaving Category as "All categories" and entering subID as:

    page-id-4,page-id-6,page-id-10,page-id-8,page-id-12,page-id-8810,page-id-144,page-id-3722

    I've tried variations on use of comma and space to separate the page-ids - but nothing works.

    Any suggestions?

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeMar 13th 2016
     
    Project Admin

    If there's an ad you'd like to display on all pages, if you don't assign that particular ad a subid, then it should always be eligible to display.

    Need help?  Quick start guide | Troubleshooting | All help topics
  5.  

    Hi Simon

    It's been a while since I've been able to get back around to this problem and now needing to solve it soon! I tried what you suggested - i.e. not assigning a subid, but the ads do not display at all !!

    The only way I can get an ad to display site-wide is to set it as a default ad for the zone.

    Any suggestions

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeJun 5th 2016 edited
     
    Project Admin

    Sorry, my original suggestion was actually incorrect!

    When you setup the ad zone code to contain a subID, the way to also include ads that don't have a subID at all is to include the phrase "empty" in the subID string.

    Imagine that $subid is a php variable that dynamically sets the subid:

    <?php
    if(function_exists('oiopub_banner_zone')) {
    oiopub_banner_zone(1, array(
    'align' => "center",
    'subid' => "empty," . $subid,
    ));
    }
    ?>

    Need help?  Quick start guide | Troubleshooting | All help topics