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 » Sidebars & Widgets »

[SOLVED] Error in PHP Coding Using PHP Text Widget


  #1  
Old Oct 28, 2009, 07:47 AM
rnimchuk
 
6 posts · Sep 2009
St. Paul, Minnesota - USA
This should be simple but for some reason it is not. I am using Executable PHP widget to place some coding within a right inner sidebar. I created a custom field named "callout_text" that is used to display a sentence or two as a callout of the current post. Within the widget, the code I am placing is:

<?php callout_text(); ?>

However, when displaying the page, I get the following error message:

Fatal error: Call to undefined function callout_text() in /home/content/r/p/n/rpnimchuk/html/wp/wp-content/plugins/php-code-widget/execphp.php(37) : eval()'d code on line 1

What the heck am I doing wrong? BTW I am using Custom Post Limits to limit the home page to a single post. I am also using WP 2.8.5 and the latest version of Atahualpa.

Thanks!

Bob Nimchuk

Last edited by rnimchuk; Oct 28, 2009 at 12:28 PM. Reason: Resolved Problem
  #2  
Old Oct 28, 2009, 10:51 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
when you use the syntax 'xxx()' php believes that you are calling the function 'xxx' so somewhere in the code there hast be
HTML Code:
function xxx(parms) {
   some
   code
   goes
   here
   }
the error is saying that php can't find the callout_text function
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Oct 28, 2009, 12:26 PM
rnimchuk
 
6 posts · Sep 2009
St. Paul, Minnesota - USA
Thanks Juggledad. Found the error of my ways. I needed to place the following code in the widget:

<?php
global $post;
echo get_post_meta($post->ID, "callout_text", true);
?>


Because this is contained within a widget you also need to declare the scope (global $post) to return the information. This works great for how I want to display part of blog's content as call out text.

Bob

Last edited by rnimchuk; Oct 28, 2009 at 12:32 PM.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected '<' in the functions.php file pingitt Atahualpa 3 Wordpress theme 6 Mar 12, 2013 03:52 AM
Where is php sidebar coding pamlicoink Sidebars & Widgets 3 Aug 12, 2009 05:07 PM
[SOLVED] messed up header.php and footer.php monochrome Header configuration & styling 0 Jun 20, 2009 02:16 PM
PHP Error peterkb Header configuration & styling 4 Jun 18, 2009 10:38 AM
Adding php in a text widget? trinity Sidebars & Widgets 2 Jun 15, 2009 08:44 AM


All times are GMT -6. The time now is 09:32 PM.


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