Git Product home page Git Product logo

agreable-advert-plugin's Introduction

Shortlist Media Wordpress Advert Plugin

Wordpress Plugin built for Croissant stack using Herbert plugin framework.


Use within Twig

Get advert HTML

<!-- Twig function -->
{{ get_advert_html(post, 'horizontal', [{'pos': 'top'}]) }}

<!-- Outputs -->

<div data-module='AdvertSlot' data-advert-id='a876sd7f65sd76f'>
  <script type='application/json'>
    { ...advert object } 
  </script>
</div>

Get advert data

<!-- Twig function -->
{{ get_advert_data(post, 'horizontal', [{'pos': 'top'}]) }}

<!-- Outputs -->
{
  'type': 'horizontal',
  'key-values': [{'pos': 'top'}],
  'devices': {
    'desktop': {
      'creative-sizes': [[970, 250], [728, 90]]
    }, 
    'tablet': {
      'creative-sizes': [[728, 90]]
    }, 
    'mobile': {
      'creative-sizes': [[320, 50]]
    }
  }
}

Use within PHP

$advert_data = AgreableAdvertPlugin\Services\AdvertSlotGenerator::get_advert_data($post, 'horizontal', ['pos' => 'top']);
var_dump($advert_data);
// Outputs
{
  'type': 'horizontal',
  'key-values': [{'pos': 'top'}],
  'devices': {
    'desktop': {
      'creative-sizes': [[970, 250], [728, 90]]
    }, 
    'tablet': {
      'creative-sizes': [[728, 90]]
    }, 
    'mobile': {
      'creative-sizes': [[320, 50]]
    }
  }
}

API routes

Get a single advert, rendered as HTML, complete with container CSS and JS to load (for Instant Articles):

/advert/{post_id}/{post_type}/{key_values}
/advert/2074/horizontal/pos=top,another_key=value

Ad type

Horizontal

  • Billboard 970x250
  • Leaderboard 728x90
  • Mobile banner
{
  'type': 'horizontal',
  'key-values': [{'pos': 'top|2'}],
  'devices': {
    'desktop': {
      'creative-sizes': [[970, 250], [728, 90]]
    }, 
    'tablet': {
      'creative-sizes': [[728, 90]]
    }, 
    'mobile': {
      'creative-sizes': [[320, 50]]
    }
  }
}

Vertical

  • HPU 300x600
  • MPU 300x250
{
  'type': 'horizontal',
  'key-values': [{'pos': 'top|2'}],
  'devices': {
    'desktop': {
      'creative-sizes': [[300, 600], [300, 250]]
    }, 
    'tablet': {
      'creative-sizes': [[300, 600], [300, 250]]
    }, 
    'mobile': {
      'creative-sizes': [[300, 250]]
    }
  }
}

In-Article

{
  'type': 'in-article (tbc)',
  'key-values': [{'pos': 'top|2'}],
  'devices': {
    'desktop': {
      'creative-sizes': [[300, 600], [300, 250]]
    }, 
    'tablet': {
      'creative-sizes': [[300, 600], [300, 250]]
    }, 
    'mobile': {
      'creative-sizes': [[300, 250]]
    }
  }
}

Skin

{
  'type': 'skin',
  'key-values': [{'pos': 'skin', 'pos': 'l|r'}],
  'devices': {
    'desktop': {
      'creative-sizes': [[300, 900]]
    }
  }
}

agreable-advert-plugin's People

Contributors

ecoad avatar jonsherrard avatar iamdeaneyelid avatar

Watchers

James Cloos avatar maciekpaprocki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.