• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

How do I add a pop up advert

The easiest way is just paste the JS code into Dashboard > Settings > Theme. If you need something more elaborated (like different pop-ups per page or things like that) it can be achieved by theme hooks, don't worry... Adding a theme hook pop-under is a walk in the park.
 
Thanks I am trying to use this code. I pasted in in the JS place on the theme setting but it did not work. Any help?

<!-- Begin JuicyAds PopUnder Code -->
<script type="text/javascript">juicy_code='74742333x256r2s2v26443e4';</script>
<script type="text/javascript" src="http://js.juicyads.com/jac.js" charset="utf-8"></script>
<!-- End JuicyAds PopUnder Code -->
 
Found it, I forgot that the code you pasted is not actually JS but HTML. In this case you need to:

1. Go to app/themes/Peafowl/custom_hooks
2. Create a file called head.php with this code:

PHP:
<?php if(!defined('access') or !access) die('This file cannot be directly accessed.'); ?>
<!-- Begin JuicyAds PopUnder Code -->
<script type="text/javascript">juicy_code='74742333x256r2s2v26443e4';</script>
<script type="text/javascript" src="http://js.juicyads.com/jac.js" charset="utf-8"></script>
<!-- End JuicyAds PopUnder Code -->


3. That's all.

The code will be placed just before the closing </head> tag. Sorry for didn't noticed earlier, but I hope you will get it running right away.

If you need more info about the custom_hooks method read this: https://chevereto.com/docs/theme#custom-hooks
 
Notepad should work, but I use Notepad++ because it doesn't have issues with bad endings or byte order mark (nerd stuff). There are plenty code editors that you can use like Brackets, Sublime Text, Textmate, etc. By the way, here is your file.
 

Attachments

  • head.zip
    372 bytes · Views: 11
I am using PopAds and found the easiest way to add the code is Settings --> External Services --> Analytics code field.

I realize this isn't the "proper" method, but it works well for me :)

Maybe a new field can be added in a future update for this use to help those of us whom lack coding skills?
 
I also use PopAds. They have some new codes. I want to hook to a *.php file containg the popup code, but ONLY from viewer pages. If possible before the closing </head> tags, but this is not obligated.

I tried to put <?php include('popads.php'); ?> inside Setting > Banners > "Before header (image page)" but that does NOT work. An iFrame doesn't work either. I also pasted the entire code into "Before header (image page)", but no luck.

I also hooked to head.php. This works, but the user experience becomes very bad, because the advert pops up with every action/click on the site. So I do not want to display popups to uploaders, users, but only to viewers. Is it possible to put the *.php popup code somehow into the Viewer Pages?

Thanks for any help!
 
Last edited:
I tried to put <?php include('popads.php'); ?> inside Setting > Banners > "Before header (image page)" but that does NOT work. An iFrame doesn't work either. I also pasted the entire code into "Before header (image page)", but no luck.
Where do you have popads.php located?
 
Dashboard > Settings > Banners works only with HTML code, not PHP code. That's why any PHP code should be added via theme override or theme hooks.
 
Theme's custom hooks will load everything so if you want something just on /image is easy as:

app/themes/Peafowl/custom_hooks/head.php
PHP:
<?php if(!defined('access') or !access) die('This file cannot be directly accessed.'); ?>
<?php if(function_exists('get_image') and G\is_route('image')) { ?>
HTML CODE HERE
<?php } ?>
 
Back
Top