• Resolved zapata

    (@zapata)


    I’m trying to use the SimplePie plugin which is a feed aggregator. I’m stumped on how to display the results in a way that I would like to in my WP Blog.

    1. After installing the plugin I created in “text” a newspage.php file which contains the SimpliePie Function that pulls in rss feeds. This file was saved in the theme folder that I am using for the blog.

    2. I went in my WP Admin screen and created a page called “News”. Here I added the following line…

    <!– #Include File=” http : //www . passionforcinema.com/wp-content/themes/alexified/newspage.php” –>

    Blah blah blah

    3. When I now click on the “News” tab on the blog, except the words “Blah blah blah” nothing shows up.

    How can I make the “News” page created in WP Admin screen, to contain the function from my plugin?

    Would appreciate any help. Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to insert Plugin function in “WP Created” page’ is closed to new replies.