Comments (4)
Ads placements have changed a lot since the writing of this issue. You can register new placements by using the Newspack_Ads::register_placement()
method.
Example of a custom placement:
/**
* Register "My Custom Placement" ad placement.
*/
function my_register_placement() {
if( ! method_exists( '\Newspack_Ads', 'register_placement' ) ) {
return false;
}
$placement_key = 'my_custom_placement';
$placement_config = array(
'name' => __( 'My Custom Placement', 'my-textdomain' ),
'description' => __( 'Choose an ad unit to display in this custom placement', 'my-textdomain' ),
'hook_name' => 'my_custom_placement',
);
\Newspack_Ads::register_placement( $placement_key, $placement_config );
}
add_action( 'init', 'my_register_placement' );
To determine where the ad should be rendered, add the action hook on your theme where you'd like it to be displayed:
<?php do_action( 'my_custom_placement' ); ?>
You can see a full list of available config options:
newspack-ads/includes/class-placements.php
Lines 331 to 348 in c2aaf62
from newspack-ads.
from newspack-ads.
Looks great, thank you for the overview, @miguelpeixe – from my PoV this can be closed.
from newspack-ads.
Thank you @dero!
from newspack-ads.
Related Issues (20)
- Extend ad suppression to allow suppression on all posts in a single category HOT 3
- Unrecoverable error on launch of ads option HOT 2
- GAM Data Display
- Ad units are getting duplicated when oauth is disconnected HOT 1
- GAM API repeatedly getting disconnected HOT 1
- Value CPM not being properly input
- Add parent path (if detected) to ad unit code HOT 2
- Only display Ad Label setting if AMP Plus enabled HOT 5
- PHP 8: sorting functions update HOT 2
- Fields and script required for ad block recovery messaging HOT 1
- Add custom choice to ad block recovery
- Only show the ad recovery message after a certain number of pageviews
- Don't show ad recovery message to subscriber or donor
- Allow Broadstreet to run in AMP Plus mode
- Fixed height settings not getting applied on placements with multiple hooks
- Restore GAM error messages HOT 2
- Change 160x600 assignment in size mapping rules
- Handle oauth without GAM networks HOT 3
- Request for guidance on displaying Adsense ads. HOT 1
- Error adding Google Ad Manager Credentials
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from newspack-ads.