WordPress.org

Ready to get started?Download WordPress

Forums

How to edit .php files in a child theme? (6 posts)

  1. Sikka
    Member
    Posted 2 years ago #

    Having some trouble with a child theme.

    I want to edit pages.php but it's not there when I look in my editor. Style.css is the only file that shows up.

    Pages.php is in my child theme directory... Do I need to change header information on .php files to makes them accessible in the editor? (And to keep them from being overwritten when I update wordpress?)

    Thanks for any help!

  2. Damian Gostomski
    Member
    Posted 2 years ago #

    Do you have FTP access to the site? If so, check if you can see and edit the file in the child theme via that

  3. Sikka
    Member
    Posted 2 years ago #

    Hi Damian. Thanks for responding. I do have FTP access.

    So is that the easiest way to do it, then? There's no way to make php files visible in the wordpress editor when working with a child theme? If so, that's fine... Just looking for confirmation that I can't somehow make them show up in my editor (if so, how?).

    Also, do you know if there's any need to edit the headers of .php files when including them in a child theme? I've edited a few of them and just want to make sure they won't be overwritten when I update.

    Cheers! :D

  4. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    Pages.php is in my child theme directory..
    There's no way to make php files visible in the wordpress editor when working with a child theme?

    there should be no problem editing child theme php files with the 'apperance' 'editor' -

    make sure to select your child theme.

    is pages.php a page template?
    in what folder exactly is the 'pages.php' of your child theme?

    and there should be no problem editing the commented area at the top of any child theme templates (just make sure that page templates have the required template name in the commented area)

  5. Sikka
    Member
    Posted 2 years ago #

    Hi there, alchymyth.

    My child theme is the current theme in use by my blog.

    Yes, pages.php is a template. It's from TwentyTen, although I've made a few edits. All the .php files are in the directory wp-content/themes/2010-child

    So it sounds like my problem is the fact that I didn't edit the headers for the php files? I've found a lot of information about changing the header for style.css (which I did) but I'm not sure what I need to do for my php files. The theme name is 2010-child. Just not sure where I'd put it in... If you know, could you tell me exactly what changes I need to make (I'm new to all of this). Here's my pages.php header:

    /**
    * The template for displaying all pages.
    *
    * This is the template that displays all pages by default.
    * Please note that this is the WordPress construct of pages
    * and that other 'pages' on your WordPress site will use a
    * different template.
    *
    * @package WordPress
    * @subpackage Twenty_Ten
    * @since Twenty Ten 1.0
    */

    Thanks so much for any help! Been trying to figure this one out for days.

  6. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    if this is supposed to be your template to show static pages, then the file needs to be called page.php.
    as far as i know, there is no need to have any information in the header of the page.

    if it is indeed a page template, and the name pages.php in intended, then it needs to have at least a section like this at the beginning:

    <?php
    /*
    Template Name: Snarfer
    */
    ?>

    http://codex.wordpress.org/Pages#Page_Templates

    whatever is the case, imho, you should have no problems editing the file under appereance -> editor

Topic Closed

This topic has been closed to new replies.

About this Topic