i’m running into the same issue. i’ve tried some hacks on the plugin by adding add_action('get_header', 'ai_content_hook')
etc. but none of them worked. i will update this thread if i figure anything out, but yeah i really like this plugin and i would really like to see it be able to work with template files. something like <?php insert_ai_ad(1); ?>
would be great
@pale2hall
You insert {adinserter Top} into the post HTML code. Ad Inserter will replace this tag with the Top block code.
@wotto
If I understand correctly you would like to include spcific Ad Inserter block from the theme PHP files?
@spacetime, I get that, but my goal is the same as wotto’s.
We would like to be able to place ads outside of posts and pages in out templates Headers and footers and places that arent normally editable without using the Theme Editor.
I want to display ads in the footer, then I add the shortcode <?php echo do_shortcode("{adinserter Footer}"); ?>
In the footer.php file located in the theme folder, but these ads can not appear. why?
I’ve understood insert {adinserter Top} into the post HTML code, but I do not understand how to insert shortcode into a php file in the theme folder.
*Sorry if my english is bad, I hope you can understand.
Thanks
No, you can not use Ad Inserter plugin in PHP code.
Will consider implementing this functionality.
Closing the thread.
Please update to the latest version 1.3.4 which has option to insert code blocks via PHP function.