How to use PHP in Atahualpa 3.6.7
This the easiest way to again use PHP in Atahualpa 3.6.7 and later versions.
We will have to edit functions.php file. Add this below code functions.php file. (Code has been take from Atahualpa 3.5.3) PHP Code:
Edit function bfa_parse_widget_areas($content) PHP Code:
Logic behind the changes The extra added function evaluates PHP using the eval function. I have added a call to that function from function bfa_parse_widget_areas because bfa_parse_widget_areas is used to create custom widget areas. So if you can create a custom widget area at a particular place then you will also be able to use PHP in that section. Still you wont be able to use php in CSS Insert. But now you know how it is done so you can easily figure out how to even use PHP in CSS Insert. You are just require to call bfa_html_inserts function before returning the result |
Remember, the eval() was taken out because of WordPress requirements. However as the user of the theme, you can make what ever modifications you want.
That said, you will have to continue to put this mod in each time the theme is upgraded and if you do this for a customer and they do an upgrade, it will be lost and you will have one unhappy customer. So if you want to do it for your self, I say go ahead. If , however, you are doing this for another, I would recommend against making this mode and find a different work around. |
You are right JD. Even i don't recommend to use this mod. And for those who can't live without the PHP then I recommend they they should still stick to version 3.6.4 till some alternatives is found by Flynn.
|
It seems that all the "fixes" are ugly hacks. I hate to think of editing functions.php, only to have it overwritten at the next upgrade. Speaking of ugly hacks, I suppose you COULD put your own custom functions somewhere else, and have Apache append that file (using the ReadmeName directive) to the bottom of functions.php whenever it's served up. That would solve the problem of upgrades overwriting your custom functions. Yes, that's so ugly, even I'm ashamed.
Jack |
Would it be possible for Atahualpa to look for 'user PHP functions' in a separate file? e.g. user_function.php. This would, by default, be empty.
Users could add all their bespoke functions in this one file and then use a 'placeholder' in the theme options to call them? i.e. %user_function(function name, parameter1, parameter2,...)% Just a thought... |
While not exactly what you are looking for you might want to check out this plugin.
|
Suggestion: Someone like me still with 3.6.4 because of this issue perhaps could turn those PHP codes into WP short codes if there were a way for using short codes in the theme options. Flynn?
BTW, the plugin Shortcode Exec PHP might be an excellent partner in this endeavor. :) |
I don't know if this will help, but I use...
Exec-PHP Version 4.9 Executes <?php ?> code in your posts, pages and text widgets. http://wordpress.org/extend/plugins/exec-php/ I am using: WordPress 3.1.3 Atahualpa 3.6.7 Atahualpa Easy Header Mod 3.6.7 (to protect my header, logo and favicon images) Exec-PHP 4.9 |
Hi LANtait,
1) Two quick questions: where do I find Atahualpa Easy Header Mod 3.6.7? 2) Will Exec-PHP 4.9 work for php code entered in Atahaulpa's theme options (say, edit post/page info items)? Thanks! |
exec-php will NOT work for php in the theme options
|
All times are GMT -6. The time now is 08:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.