WordPress.org

Ready to get started?Download WordPress

Forums

How do I add code to page? (7 posts)

  1. loybanks
    Member
    Posted 4 years ago #

    I have a page named mynews.php.....

    I want to add this php code to the page......<?php include("/home/loy21240/public_html/news/news.php"); ?>

    But where do I go in my Administration Panel to add this code to page? And how do I go about adding it?

    I've gone around and around with this issue, but simply can't determine how to do this.

    Thanks so much.

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    you've made the page through wordpress' page interface?

    Or mynews.php is a page template?

    or is it a standalone php document?

  3. loybanks
    Member
    Posted 4 years ago #

    A page I made thru WordPress.

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    well.... if you have a page you made through wordpress.... calling it mynews.php isn't really necessary. It could just as easily be My News

    Making a page through wordpress doesn't make any new file.... php or otherwise.

    It's just info stored in your database.

    To be able to run your php from within your page, you have a couple options.

    You could make a new page template following the guidance I linked to above. Name it something like mynews.php and assign it to your news page. The new template could simply be an exact copy of page.php with the appropriate header, and your code from your original post inserted

    If you don't want to go that route, there are plugins which allow php code to be run from directly within a post/page

    http://wordpress.org/extend/plugins/exec-php/
    is one of them.....

  5. loybanks
    Member
    Posted 4 years ago #

    Made thru Administration>Pages>AddNew

    I should have mentioned in earlier posting.

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    Made thru Administration>Pages>AddNew

    yup, I gathered that. My reply above has your options

  7. loybanks
    Member
    Posted 4 years ago #

    Thanks a bunch my friend. Your help is appreciated. If I need more I'll get back to you.

Topic Closed

This topic has been closed to new replies.

About this Topic