Jump to content


Replying to hooks and php code


Post Options

  or Cancel


Topic Summary

Ronald

Posted 04 May 2011 - 02:24 AM

Hi,

if you can get this to work in a WordPress theme, you can also get it to work in Builder. I suggest you try adding your code and functionality using the default twenty-ten theme, and if that works fine, I see no reason why it should not work in Builder.

If you want particular support on Builder, please post in the Builder support forum.

Ronald

Randy Robinson

Posted 03 May 2011 - 03:40 PM

Some of our code would gather data from databases and display, and as far as I can tell, we can do that within a page with the html module.

But some of the code needs to grab a REQUEST variable from the URL or a form which sent the person to the site and save a cookie which we have to look up when someone signs up for membership (to have the source of each member). It's possible that based on this variable, the page that opens may vary which is why it can't be done after the page has loaded. Will code in header.php do this?

Ronald

Posted 02 May 2011 - 04:25 PM

Hi,

you can always safely add code to header.php, as long as you make sure to use a child theme, and make such modifications in the header.php file in the child theme folder.

Using the functions.php file, and the standard WordPress wp_enqueue_script function, you can add (external) javascript to your site.

And it depends on the php code that you need to insert. Do you need to add the code inside the <head> section of your site, or if it should be executed before pages display (as you say), but contains html code that should go in the <body> section of your site.

Ronald

Randy Robinson

Posted 02 May 2011 - 03:52 PM

I'm not sure if putting this php code INSIDE the header will or won't mess up the format of the page. The header is the place for javascript. Is there any other place to put php code?

Failing this, could I safely add my code to the header.php?

Sridhar Katakam

Posted 30 April 2011 - 09:35 PM

Builder does provide a text area in which code to be inserted between <head> and </head> can be added.

For an example, see http://ithemes.com/wp-content/uploads/2010/12/enable-google-analytics-540x358.png

(below the highlighted area)

Posted 30 April 2011 - 04:27 PM

I have a need to have custom php code on all pages before anything is displayed. In several other frameworks, there are hooks which include "pre header" and others. I can't find anything like that in builder. Does something like this exist? How would one add php code to each page to do some database lookups and other functions before the page starts loading? I've narrowed my choice of frameworks down to builder and catalyst. Catalyst includes the hooks I need, but I like builder better. But liking it better doesn't get the job done if it won't do what I need.

Thanks.

Review the complete topic (launches new window)