Jump to content
Sign in to follow this  
maxpower1

Add Code To Blog Page Template

Recommended Posts

maxpower1    0
maxpower1

I have php mobile redirection code that I need to add to blog page template.  I understand it is deemed a "special page", but how do I add the code via functions.php?

 

Thanks.

Share this post


Link to post
Share on other sites
James B    436
James B

Hi there, if you download the action map plugin you'll be able to see where the actions are on the template. http://www.pagelines.com/store/plugins/pagelines-action-map/

 

Or you can check out http://api.pagelines.com/hooks where there's a written list.

 

When you've chosen the action you want to use, then you can insert your code via a hook in the functions.php. Or you could use the new hooker plugin which is literally a case of select which hook and copy/paste/save :-)

 

http://www.pagelines.com/store/plugins/hooker/


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
maxpower1    0
maxpower1

The Hooker plug in looks great, but...  

 

I only need to add code to the absolute top of blog page.  This is not global redirection code, only certain templates require it.  I have the code placed on all page.php templates that require it, except I cannot find template for blog page.

 

Is there a hook specifically for this.  I cannot see it in the list.

 

Thanks.

Share this post


Link to post
Share on other sites
James B    436
James B

Well from what I can see there isn't a template specifically for the blog template. It's dynamically created from the database calling in the required sections and class.posts.php. I'd imagine if it was possible you'd have to use some php to target that prior to using the hook to insert the code, as the first hook called on the page would be 'pagelines_before_html'.

 

I'll need to check with a developer if this if possible. So leave it with me and someone will come back to you shortly.

 

Have you inserted the code into the other page templates you mentioned using the functions.php or by actually editing the core files? We don't advise you edit any core files as any changes will get wiped on update.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
maxpower1    0
maxpower1

We have edited the core files for now.  Any recommendations for adding code to page templates via functions.php?

Share this post


Link to post
Share on other sites
maxpower1    0
maxpower1

We are running a child theme.  If I edit the template files in there, I should not lose any changes when updating framework, correct?

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

Sign in to follow this  

×