Jump to content
fpgeeks

How To Add Code To The Blog Post Template?

Recommended Posts

fpgeeks

For instance, using this page 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?

ScreenShot2012-11-17at42041PM.jpeg

Share this post


Link to post
Share on other sites
batman

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

http://api.pagelines.com/hooks

You can see this links to begin:

http://www.pagelines.com/wiki/How_to_Use_the_PageLines_Customize_Plugin

http://codex.wordpress.org/Plugin_API


Life is too short to remove USB safely ...

Share this post


Link to post
Share on other sites
Rob

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.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
fpgeeks

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

http://api.pagelines.com/hooks

You can see this links to begin:

http://www.pagelines...ustomize_Plugin

http://codex.wordpress.org/Plugin_API

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.

Share this post


Link to post
Share on other sites
Rob

If you want the ad to appear in the midst of the content area list of posts, the option is then to use Special Recent Posts 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.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
fpgeeks

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

http://api.pagelines.com/hooks

You can see this links to begin:

http://www.pagelines.com/wiki/How_to_Use_the_PageLines_Customize_Plugin

http://codex.wordpress.org/Plugin_API

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

Share this post


Link to post
Share on other sites
fpgeeks

If you want the ad to appear in the midst of the content area list of posts, the option is then to use Special Recent Posts 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.

Share this post


Link to post
Share on other sites
Simon

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()

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×