lonepress
Chevereto Member
Fair warning: this guide is pretty involved, and will probably take you a couple hours to complete even if you know what you're doing editing code. If you don't know what you're doing, you probably should find someone to help you who does .
Chevereto lets you specify code snippets for banner ads to show on image pages. But ad programs like adsense don't allow you to display ads on NSFW images. You can disable banners for NSFW images, but there are still 2 problems:
You will be able to:
This guide is broken down into three phases:
Phase 1: Add new settings for banner code, and add a sfw_whitelisted flag to the images database table.
Phase 2: Support editing new banner code in the dashboard, and change which banner is shown on the image page, based on whether the image is NSFW or whitelisted.
Phase 3: Support filtering images on the dashboard page, and modifying their whitelist value with the Action menu.
Chevereto lets you specify code snippets for banner ads to show on image pages. But ad programs like adsense don't allow you to display ads on NSFW images. You can disable banners for NSFW images, but there are still 2 problems:
- You might want to show different ads on NSFW images (for example, an ad network that allows NSFW content but generates a lower RPM).
- Ads will be shown on images where the user failed to flag a NSFW image as NSFW, which has the potential to get your adsense account banned.
You will be able to:
- Edit banner code for the two new banner types in the dashboard, next to the existing banner code.
- Filter images to show any combination of SFW/NSFW and Whitelisted/Not whitelisted when viewing images in the dashboard.
- Select multiple images in the dashboard, and whitelist them all (un-whitelist them) using the Action dropdown menu.
- You really should be at least somewhat comfortable modifying PHP code.
- You need to be comfortable editing chevereto code, including some core stuff outside of the theme directory. This will introduce some complexity with new chevereto releases, as you will need to make sure that conflicts introduced in the future are merged with your code correctly.
- Just in case it goes horribly wrong: back up your database and website files.
- Trying this on a development site before editing your live website code. There's a small chance I've left something out, and you don't want to use your production site as a guinea pig.
- Using a source code revision control system like git to track your changes to chevereto code.
- I personally use git, and keep a separate branch (called "chev-virgin") with NO changes to the chevereto code.
- When a new release comes out, I apply it in that branch, then use git to merge it into my development branch, easily identifying conflicts along the way.
- Learning git it outside the scope of this guide, but if you're going to get into editing core chevereto code without a way to track, rollback, and merge your changes with new releases, you're going to have a hard time.
This guide is broken down into three phases:
Phase 1: Add new settings for banner code, and add a sfw_whitelisted flag to the images database table.
Phase 2: Support editing new banner code in the dashboard, and change which banner is shown on the image page, based on whether the image is NSFW or whitelisted.
Phase 3: Support filtering images on the dashboard page, and modifying their whitelist value with the Action menu.
Last edited: