Forums

How to insert a custom function into every post? (5 posts)

  1. Wendel Brume
    Member
    Posted 2 years ago #

    I need to insert a DIV that contains ad code at a specific location in every post. Since I may change ad networks later, I don't want to have to go back and revise old posts. I'd like to have a place where the ad code is written once, and then called into the posts at the location where I want it.

    What's the best way to set this up? I was thinking that it would be a custom function, but if there is a better way I'd like to know.

  2. ourlifeintext
    Member
    Posted 2 years ago #

    just insert the div code into your singlepost.php page?

  3. Wendel Brume
    Member
    Posted 2 years ago #

    Unfortunately I need to split the content of the post, with the ad code DIV. So I need to place it in the middle of the post content. It needs to be a line of code that is in each post that goes and gets the DIV. I don't want to write the entire ad code in each post since I may change ad networks.

  4. alchymyth
    The Sweeper
    Posted 2 years ago #

    read up about 'shortcodes' in wordpress
    http://codex.wordpress.org/Shortcode_API

    and check plugins if you haven't done yet.

  5. renato_s
    Member
    Posted 2 years ago #

    I would definitely go with shortcodes.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags