You check with the authors site? The author’s instructions?
Your method above doesn’t sound right.
Thread Starter
zapata
(@zapata)
The doc doesn’t mention much except use the function in a footer or sidebar.
But I would like to use the function in a WordPress created page.
So is there anyway possible to insert a Plugin Function in a WordPress page. How do I get a wordpress page to contain a PHP function?
You need a plugin to let you put PHP directly into the body of a page. CG-QuickPHP is a good one, by all accounts: http://www.chait.net/index.php?p=310
A better way is to make a new page template with the code you want in it, and then use that page template for your page.
Thread Starter
zapata
(@zapata)
Otto, Thanks a million. As to your suggestion, here’s what I had tried and failed in (please excuse my non programming knowledge)
1. Created a page called newspage.php and saved it in my blog theme folder
Looked like this :
<?php get_header(); ?>
<?php require(‘sidebar.php’);?>
<div id=”content”>
<!– *** HERE’S WHERE I ADDED MY PLUGIN FUNCTION ** –>
</div>
<?php require(‘rightbar.php’);?>
<?php get_footer(); ?>
Now if I type in this url
www. mywebsite.com/newspage.php — I get page not found
if i type the complete url
www. mywebsite.com/wp-content/themes/themename/newspage.php — I get this error:
Fatal error: Call to undefined function: get_header() in /home/xyz/public_html/pfc-com/wp-content/themes/alexified/newspage.php on line 3
Hence thought it would be easier for a nonprogrammer like me to find something where I can insert php function directly into wp created page
Don’t access the page directly. The files you put in the themes are Templates, not actual pages you directly call.
Add this to the top of your newspage.php file:
<?php
/*
Template Name: My News Page
*/
?>
Then create a new “Page” in WordPress using the Write->Write Page function. Call it anything you like. On the right hand side of the page, you’ll see a drop down box called Page Template. Pull it open and select your news page template. Then publish the page.
Voila.
Thread Starter
zapata
(@zapata)
How can I insert echo in quickphp? The function I am calling doesn’t have an inbuilt echo function.
oopsie, just saw that you replied to my other question, while I downloaded and installed quickphp
If you want to use QuickPHP, you just do this in your posts:
<quickphp echo 'stuff'; />
If you want to echo the output of function_call(), then you’d do this:
<quickphp echo function_call(); />
Thread Starter
zapata
(@zapata)
OH MY GOD… YOU SUGGESTION ON CREATING WP PAGE AND SELECTING PAGE TEMPLATE WORKED!!!!!!!!!!!!!!
Otto Please advise where can I should Fed-Ex you a 6 pack chilled beer
Thank you so much!!!
Thread Starter
zapata
(@zapata)
Interestingly when I use quickphp with echo in the WP Page itself nothing shows up, but when I revert back to your first suggestion of selecting My News Page template – then everything prints out smoothly.
zapata: QuickPHP will work, but you do need to select a template that actually displays the_content() in order for it to try to display the post itself, thus making QuickPHP actually get called. If your template doesn’t show the text of your post, it never happens.
Anyway, I think the template approach is better because having the ability to put PHP directly into your posts is not exactly the safest way to do things.