Support » Fixing WordPress » How do I add code to page?

  • 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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • you’ve made the page through wordpress’ page interface?

    Or mynews.php is a page template?

    or is it a standalone php document?

    Thread Starter loybanks

    (@loybanks)

    A page I made thru WordPress.

    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…..

    Thread Starter loybanks

    (@loybanks)

    Made thru Administration>Pages>AddNew

    I should have mentioned in earlier posting.

    Made thru Administration>Pages>AddNew

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

    Thread Starter loybanks

    (@loybanks)

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How do I add code to page?’ is closed to new replies.