| 开发者 | planyourhost |
|---|---|
| 更新时间 | 2026年10月3日 04:47 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[pyh_ads id="123"] shortcode, the PYH Ad block, the PYH Ads widget, or template tags.
Rotation
When several ads compete for one placement, choose highest priority, weighted random, even rotation, random, or best CTR.
Analytics
pyh_ads_display( 123 ); prints a specific addo_action( 'pyh_ads_placement', 'header' ); prints whichever ad wins a placementpyh_ads_capability, pyh_ads_ad_html, pyh_ads_allowed_html, pyh_ads_custom_placementspyh-ads folder to /wp-content/plugins/, or install the plugin from Plugins → Add New.No. Custom HTML ads are sanitised with wp_kses(): scripts, iframes and forms are removed when you save and when the ad is displayed. For Google AdSense, enter your publisher ID and ad slot ID and the plugin creates the ad unit. Managing ads requires the manage_options capability, which you can change with the pyh_ads_capability filter.
Yes. Ads are rendered on the server and tracked by a small script that reports to a REST endpoint, so cached pages are still counted. With full-page caching, which ad wins a placement is decided when the page is cached.
No. AdSense renders inside a cross-origin iframe, so browsers do not let the page see clicks. Impressions are tracked; use your AdSense reports for clicks. The same applies to embedded YouTube and Vimeo players.
Header and homepage hero use the standard wp_body_open hook. If your theme does not call wp_body_open(), use the shortcode or do_action( 'pyh_ads_placement', 'header' ) in your template.
Use <?php pyh_ads_display( 123 ); ?> for a specific ad, or <?php do_action( 'pyh_ads_placement', 'sidebar' ); ?> for whichever ad wins that placement.
No. Targeting applies to automatic placements. An ad inserted with a shortcode, block or widget-by-ID appears where you put it, as long as it is active and within its schedule.
Use PYH Ads → Tools → Delete All PYH Ads Data, or tick "Delete all ads, analytics and settings when the plugin is deleted" under PYH Ads → Settings. Data is kept by default when you delete the plugin.