WordPress.org

Ready to get started?Download WordPress

Forums

Ad Inserter
[resolved] Insert shortcode into template (8 posts)

  1. pale2hall
    Member
    Posted 7 months ago #

    My question is the same as one that has already been asked, but never truely resolved.

    I would like to insert my banners in a location in my template that does not use the fancy editor.

    I did some research and found
    <?php echo do_shortcode("{adinserter Top}"); ?>

    but it doesn't seem to work with these shortcodes.

    tl;dr How can I use this plugin in the template's source code?

    I know PHP, MySQL, HTML & CSS, but am still pretty new to wordpress.

    Sincerely,
    Pale2Hall

    http://wordpress.org/plugins/ad-inserter/

  2. wotto
    Member
    Posted 7 months ago #

    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

  3. spacetime
    Member
    Plugin Author

    Posted 7 months ago #

    @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?

  4. pale2hall
    Member
    Posted 7 months ago #

    @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.

  5. Dautic
    Member
    Posted 7 months ago #

    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

  6. spacetime
    Member
    Plugin Author

    Posted 7 months ago #

    No, you can not use Ad Inserter plugin in PHP code.

  7. spacetime
    Member
    Plugin Author

    Posted 7 months ago #

    Will consider implementing this functionality.
    Closing the thread.

  8. spacetime
    Member
    Plugin Author

    Posted 5 months ago #

    Please update to the latest version 1.3.4 which has option to insert code blocks via PHP function.

Reply

You must log in to post.

About this Plugin

About this Topic