Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

How to use PHP in Atahualpa 3.6.7

Old May 20, 2011, 01:45 AM
sudipto's Avatar
15 posts · Feb 2011
LetusBuzz.com Powered by Wordpress and Atahualpa
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:
function bfa_html_inserts($custom_code) {
    global $bfa_ata; 
    if($custom_code != '') {
        if ( strpos($custom_code,'<?php ') !== FALSE ) {
                $custom_code = ob_get_contents(); 
    return $custom_code; 

Edit function bfa_parse_widget_areas($content)

PHP Code:
function bfa_parse_widget_areas($content) {
    if ( strpos($content,'<?php bfa_widget_area') !== FALSE ) {
        $content = preg_replace_callback("|<\?php bfa_widget_area(.*)\((.*)'
       $content=bfa_html_inserts($content); /******** ADD THIS LINE *************/
    return $content; 

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

Last edited by sudipto; May 20, 2011 at 01:50 AM.
Old May 20, 2011, 04:55 AM
juggledad's Avatar
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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.
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
Old May 20, 2011, 05:23 AM
sudipto's Avatar
15 posts · Feb 2011
LetusBuzz.com Powered by Wordpress and Atahualpa
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.
Old May 28, 2011, 09:01 AM
20 posts · Dec 2009
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.

Old May 31, 2011, 02:59 AM
64 posts · Jun 2010
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...
Old May 31, 2011, 09:14 AM
lmilesw's Avatar
10,176 posts · Jul 2009
Central New York State USA
While not exactly what you are looking for you might want to check out this plugin.
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Atahualpa 3.6.4 and PHP 5.3.5 --> Stream bfa:// cannot be opened (PHP 5.2.17 works) Jan New Versions, & Updating 0 May 3, 2011 07:15 AM
Atahualpa child theme function php kdawes01 Atahualpa 3 Wordpress theme 1 Sep 23, 2010 03:58 AM
[SOLVED] Stand alone php page on Atahualpa theme catherinehbbh Forum How-To 2 Apr 7, 2010 07:34 PM
PHP Catchable fatal error: themes/atahualpa/functions/bfa_meta_tags.php on line 169 Shamisen Plugins & Atahualpa 0 Apr 6, 2010 10:43 PM
How to edit single.php in atahualpa? Chloe Plugins & Atahualpa 8 Jan 29, 2010 02:58 PM

All times are GMT -6. The time now is 05:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.