Purchase OIOpublisher now for just $47.

Take control of your ad space.

Click here to purchase

    • CommentAuthorpagerank
    • CommentTimeJan 9th 2017 edited
     

    Hi Simon,

    I need to create a front-end directory of all paid ads - it would simply display the Alt Texts for every paid ad in ascending alphabetical order. I'm using Wordpress 4.7 and OIO v2.62, so a shortcode would be ideal. Could you help me do this?

    Thanks,
    Chris

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeJan 22nd 2017
     
    Project Admin

    You'd have to wrap this up in a separate shortcode (or allow php code execution in posts), but the underlying php code to retrieve alt text would be something like this:

    //retrieve global vars
    global $oiopub_set, $oiopub_db;
    //sql for live banner ad data
    $sql = "SELECT * FROM " . $oiopub_set->dbtable_purchases . " WHERE item_channel=5 AND item_status=1 AND payment_status=1 ORDER BY item_tooltip ASC";
    //run query
    if($res = $oiopub_db->GetAll($sql)) {
    //loop through results
    foreach($res as $ad) {
    //display banner image
    echo '<p><a href="' . $ad->item_page . '">' . $ad->item_url . '</a></p>';
    //display alt text
    echo '<p>' . stripslashes($ad->item_tooltip) . '</p>';
    }
    }

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorpagerank
    • CommentTimeJan 23rd 2017
     

    Simon, Thanks for your help!
    This worked perfectly.

    Best wishes,
    Chris

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeJan 29th 2017
     
    Project Admin

    No problem, glad it did the trick.

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