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 » Plugins & Atahualpa »

Enhanced text widgets and PHP plug-ins


  #1  
Old Jun 6, 2011, 12:29 PM
ArtG
 
25 posts · Apr 2011
Just want to check a few assumptions I am making before implementing the enhanced text widget solution for 3.6.7+

1) Because such widgets have not been removed from WP's Plug-in Directory, placing PHP in these widgets resolves the following matter which prompted the removal of our being able to use PHP within theme options. from BFA homepage:

Quote:
No custom PHP code anymore: After the “Eval” function was not permitted anymore in themes, the alternative “stream wrappers” caused issues on all hosts where Suhosin was installed. The remaining option “temp. files” isn’t an option either because that requires file operations again. Atahualpa was one of few themes, if not the only one, to offer the ability to add custom PHP through theme options. This is not possible anymore in themes listed on wordpress.org. There might be workarounds or even alternative theme options in the near future, here or on the forum.

2) The removal of being able to add PHP through the theme options does not impact the ability to add PHP to a page or post when using a plug-in like Exec-PHP.


Thanks!
  #2  
Old Jun 6, 2011, 12:50 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you got it, plugins can use the eval() function, but themes can not...strange but true.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Jun 7, 2011, 03:16 PM
ArtG
 
25 posts · Apr 2011
Juggledad, your tips and assistance have been very helpful. Just sent something your way via PayPal to say thanks.

Seems I can't use the text widget approach since I can't add a new widget area to locations where I am using PHP: multi- and single-post kickers, bylines, and footers. So I looked around elsewhere on this forum, as well as in the codex and in Atahualpa's code, and have come up with the following idea. Any feedback, tips, or alternative ideas you might have would be most welcome.

Problem to solve: no longer able to use PHP to create custom kicker/byline/footer format and content for different types of posts.

Solution:create a child theme that contains just two files, the required style.css which simply imports Atahualpa's style.css, and a functions.php containing...

PHP Code:
function new_bylines() {
    
$single_by //code from ATO single-post byline goes here;
    
return apply_filters 'post_byline_single' $single_by );
    
$multi_by //code from ATO multi-post byline goes here;
    
return apply_filters 'post_byline_multi' $multi_by );

...which would be revised and repeated to do the same thing for the 'hooks' post_footer_single, post_footer_multi, post_kicker_single, and post_kicker_multi which are found in bfa_post_parts.php.

Would this work? If so, can I literally copy what I have in ATO fields, such as post info items which contain %, into these functions? Is there an easier way?

Last edited by ArtG; Jun 7, 2011 at 04:03 PM.
  #4  
Old Jun 7, 2011, 04:21 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
can you export you theme settings and attach them to a reply ato->export/import settings
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Jun 7, 2011, 04:35 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
actually I just tried creating a new widget area in the kicker and it works. Did you try it?

because the code can get parse ad it knows about the bfa_widget_area() function, it can parse that code, it just can't parse other php, like if statements etc.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Jun 8, 2011, 07:42 AM
ArtG
 
25 posts · Apr 2011
I was able to create a widget area in the kicker - but only after I actually upgraded to 3.6.7 on my test site.

After doing so, and making sure the standard text widget could use php through the plug in Exec-php, I was able to enter this into the text box in my kicker widget area...

PHP Code:
<?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
...and get the desired results. I then added some logic...

PHP Code:
<?php 
if ( 0) {
 Echo 
"<b>Tell your friends: </b>";
 if ( 
function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } }
else {
 Echo 
"<b>Why do I see this?</b>";
}
?>
...and was surprised to see I got exactly what I wanted. However, even though this is in the kicker, when adding a post info item into the mix...

PHP Code:
<?php 
if ( 0) {
 Echo 
"<b>Tell your friends: </b>";
 if ( 
function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } }
else {
 Echo 
"<b>Why do I see this?</b>";
}
?>
<b>You are here: </b>%category%
...I would get %category% regardless of any combination of the above that crossed my mind.

As requested I am sending a copy of my theme settings via PM. This is from the 3.6.4 version but I doubt that matters given I assume you are looking at the php I am placing in the multi- and single- kicker, byline, and footer fields. I am also including a few PDFs of the actual site pages showing the results we want using 3.6.4.

I realize now some of my php logic could be simplified by retrofitting the site with custom posts and using their ID numbers instead of content fields from the posts and I will make those changes. Just not sure how to solve the issue surrounding post info items.

Last edited by ArtG; Jun 8, 2011 at 07:48 AM.
  #7  
Old Jun 8, 2011, 07:58 AM
ArtG
 
25 posts · Apr 2011
Oops. Thought I could send via PM. I'll try attaching here.

Last edited by ArtG; Jun 15, 2011 at 10:13 AM.
  #8  
Old Jun 8, 2011, 09:20 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
so I think this will work. Lets take the example of what you have in the 'KICKER: Single Post Pages'
HTML Code:
<div class="breadcrumbs">
<table width="100%" >
<tbody>
<tr>
<td>
<?php
if(function_exists('bcn_display'))
{
    bcn_display(false, false);
}
?>
</td>
<td style="text-align: right;">%wp-print%</td>
</tr>
</tbody>
</table> 
</div>
<?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
to implement this in 3.6.7 you will have to do this - since there are two PHP sections, you need to create two widget areas
HTML Code:
<div class="breadcrumbs">
<table width="100%" >
<tbody>
<tr>
<td>
<?php bfa_widget_area('name=Kicker_area_singlepostpage1'); ?>
</td>
<td style="text-align: right;">%wp-print%</td>
</tr>
</tbody>
</table> 
</div>
<?php bfa_widget_area('name=Kicker_area_singlepostpage2'); ?>
then you add a text widget to both and in 'Kicker_area_singlepostpage1' you add
HTML Code:
<?php
if(function_exists('bcn_display'))
{
    bcn_display(false, false);
}
?>
and in 'Kicker_area_singlepostpage2' you add
HTML Code:
<?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
HOWEVER, if you want to conditionally put in any of the theme parameters line '%wp-print%' this will not work. Unfortunately I can't think of a way to conditionally add the theme parameters. Sigh...why did you restrict the eval() Wordpress...Why?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #9  
Old Jun 8, 2011, 03:32 PM
ArtG
 
25 posts · Apr 2011
Thanks, Juggledad.

The theme parameter %wp-print% requires the plug-in WP-print which has the following in their documentation:

Quote:
<?php if(function_exists('wp_print')) { print_link(); } ?>

Last edited by ArtG; Jun 15, 2011 at 10:08 AM. Reason: Found solution!

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio - MP3 File - blip.tv - plug ins eager to learn Plugins & Atahualpa 1 Jun 2, 2010 03:29 AM
Lightbox/Featured Content Plug-Ins for Atahualpa writeleft Atahualpa 3 Wordpress theme 1 Apr 2, 2010 08:49 AM
Widgets page and plug ins add page not working, and displaying differently shamrock 2000 Sidebars & Widgets 10 Feb 16, 2010 04:19 PM
Analytic Type Plug Ins/Issues/Questions jfrenaye Plugins & Atahualpa 2 Oct 5, 2009 05:59 PM
Using Page2Cat with SmoothGallery plug-ins... gallery not working? harpek Plugins & Atahualpa 2 Aug 2, 2009 08:25 PM


All times are GMT -6. The time now is 06:48 AM.


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