Jump to content


Photo
- - - - -
Open

How To Add Code To The Blog Post Template?



  • Please log in to reply
7 replies to this topic

#1 fpgeeks

fpgeeks

    Newbie

  • Members
  • 9 posts

Posted 17 November 2012 - 10:43 PM

For instance, using

Please Login or Register to see this Hidden Content

as a general example, I would like to add code (I have both php and javascript that I can use) to place a banner ad at the end of the post content but before the "related post suggestions". See the layout below. So my question is, where would I insert the required code so it shows up on all blog posts?

Posted Image

#2 batman

batman

    Bat Learning

  • Members
  • 1,003 posts
  • LocationBuenos Aires, Argentina
  • Framework Version:2.4.3
  • Country: Country Flag

Posted 17 November 2012 - 10:48 PM

Hi fpgeeks
You can add an action for add meta setting below.
For example the action: pagelines_loop_after_post_content
You can find at

Please Login or Register to see this Hidden Content


You can see this links to begin:

Please Login or Register to see this Hidden Content


Please Login or Register to see this Hidden Content



#3 Rob

Rob

    One Smart Egg

  • Moderators
  • 9,866 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 18 November 2012 - 12:18 AM

Since you describe the end of your post's content area for this hook, you can perhaps use a universal sidebar set above the morefoot or footer (if you don't use morefoot). The ad code could be included in a text widget in that sidebar.

You can also use the full-width sidebar.

#4 fpgeeks

fpgeeks

    Newbie

  • Members
  • 9 posts

Posted 18 November 2012 - 12:32 AM

Hi fpgeeks
You can add an action for add meta setting below.
For example the action: pagelines_loop_after_post_content
You can find at

Please Login or Register to see this Hidden Content


You can see this links to begin:

Please Login or Register to see this Hidden Content


Please Login or Register to see this Hidden Content


Thanks. I'll definitely look into this and almost certainly come back with questions.

Since you describe the end of your post's content area for this hook, you can perhaps use a universal sidebar set above the morefoot or footer (if you don't use morefoot). The ad code could be included in a text widget in that sidebar.

You can also use the full-width sidebar.

I've tried this but the problem is that it puts my ad after the related-post-plugin content.

#5 Rob

Rob

    One Smart Egg

  • Moderators
  • 9,866 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 18 November 2012 - 06:42 PM

If you want the ad to appear in the midst of the content area list of posts, the option is then to use

Please Login or Register to see this Hidden Content

plugin.

This plugin will allow you to customize a shortcode to display the postloop on a static page. You can, for example, set up a shortcode to display 5 recent posts at the top; implement your ad code; then implement a second group of Special Recent Posts shortcode that offsets by 5, so it basically continues where the previous 5 posts ended. You can do this three times on a page, resulting in 15 posts, with two breaking ads. See below:

SRP 5 posts
ad code
SRP 5 posts (offset by 5)
ad code
SRP 5 posts (offset by 10)

When you add the shortcode and ad code, make absolutely sure you do so in the HTML view, not in the VISUAL view of the page's edit page.

#6 fpgeeks

fpgeeks

    Newbie

  • Members
  • 9 posts

Posted 09 December 2012 - 10:10 PM

Hi fpgeeks
You can add an action for add meta setting below.
For example the action: pagelines_loop_after_post_content
You can find at

Please Login or Register to see this Hidden Content


You can see this links to begin:

Please Login or Register to see this Hidden Content


Please Login or Register to see this Hidden Content

So, I read through this and I don't have a clue how to use any of it. 



#7 fpgeeks

fpgeeks

    Newbie

  • Members
  • 9 posts

Posted 09 December 2012 - 10:12 PM

If you want the ad to appear in the midst of the content area list of posts, the option is then to use

Please Login or Register to see this Hidden Content

plugin.

This plugin will allow you to customize a shortcode to display the postloop on a static page. You can, for example, set up a shortcode to display 5 recent posts at the top; implement your ad code; then implement a second group of Special Recent Posts shortcode that offsets by 5, so it basically continues where the previous 5 posts ended. You can do this three times on a page, resulting in 15 posts, with two breaking ads. See below:

SRP 5 posts
ad code
SRP 5 posts (offset by 5)
ad code
SRP 5 posts (offset by 10)

When you add the shortcode and ad code, make absolutely sure you do so in the HTML view, not in the VISUAL view of the page's edit page.

Thanks for the info, but this isn't what I'm trying to accomplish. If I understand this correctly, this would allow me to insert ads between posts on the blog page. What I want to do is add an ad inside of a blog post, but at the end of the post content and before the before the Related Post Plugin, as shown in the image above.



#8 Simon_P

Simon_P

    Messer

  • Administrators
  • 5,157 posts
  • LocationDevon
  • Framework Version:trunk
  • Country: Country Flag

Posted 09 December 2012 - 10:26 PM

If your not already using the free contentbox section, then this is super simple.

 

1. install the free contentbox section.

2. drag it into the 'blog post' content area.

3. go to pagelines => page options and click site defaults

4. add your ad code to the contentbox global settings.

 

 

thats it.

 

If your already using the content box then your going to have to use some php to add the code using add_action()






Click to return to top of page in style!