• Hi, I’m a total newbie in css, html and php, and just read a bit on child pages etc. Adding css to a child page I can see helping somewhat, when I want to change the formatting or use display:none to delete something, but won’t work, as far as I can see,for adding images or text etc to a static or post page.
    So I assume I can change the html/xhtml in the .php files, but what must I watch out for? Practising on my site, deleting bits of .php code seems to make very little difference to how the header/footer/sidebar etc appear. But I am pretty unsure,and would really appreciate any advice, suggestions etc.
    Oh yes, and what effect could I be having on SEO?
    I can’t give you a URL cos I am editing locally.
    Any help would be much appreciated,
    Robin

Viewing 5 replies - 1 through 5 (of 5 total)
  • You add images or text to pages in the Dashboard’s Page editor, and to posts in the Dashboard’s Post editor.

    I don’t understand why you would want to mess about with the template files to do this. It’s just basic Page and Post creation stuff.

    If you’ve altered the template files for any of the default themes without doing so in a child theme, you should make sure you put them back where they were. Default themes should never be edited except via a child theme. The best way to do this might be by reinstalling the theme(s).

    Thread Starter tutorsu1

    (@tutorsu1)

    Please correct me if I’m wrong, but css is for editing the format/look of pages, but what if I want to add writing to the header? How can I do that without editing the php? I can edit the text in the body of the post or page with the page/blog edit in the dashboard, but I don’t see how to do that for the header or the footer. Is there a way to get a text input into the header? I think I can do it for the sidebar, because there is a widget to do this.
    Thanks for your help

    Terminology problem. You want to alter the ‘template’. A page in WP-speak is something you create and edit in the Dashboard. As is a post.

    Sorry about that.

    To add something like an image to the header, assuming your theme follows standard conventions:

    • Create a minimal Child Theme
    • Copy your parent theme’s header.php file to the child theme’s directory
    • Go to Dashboard –> Appearance –> Editor
    • Select the link to the Header (header.php)
    • Add the necessary HTML/CSS code to the file
    • Save your changes
    • View your changes to make sure they work OK. You might have to refresh the page in your browser
    • Add any style rules you need to your child theme’s style.css file, also accessed from Dashboard –> Appearance –> Editor

    Things work the same for the footer except you want footer.php. The sidebar, if you can’t use a widget is in sidebar.php. Assuming your theme follows standard conventions.

    HTH

    PAE

    Thread Starter tutorsu1

    (@tutorsu1)

    Thank you very much for your advice. It really helps clear things up for me. I knew that you could add .php files to the child directory, but it hadn’t occurred to me to copy the parent one over and edit that one. Because it’s in the child directory, it would get used in preference to a .php file in the parent folder.
    May I ask another quetiont? If a child template seems to work in different browsers, is that ok, or is there a danger that deleting some objects that I didn’t want on the template will mess up SEO? Or perhaps mean something else doesn’t work?
    Thanks again
    yours
    Robin

    Your child theme should only contain files that contain your changes. Your parent theme should be entirely unaltered from its default state. That’s the point of using a child theme, to leave the parent theme unchanged.

    Your child theme should not contain any files unchanged from the parent theme: only files with changes. Given that, you obviously can’t delete them or you’ll lose your changes.

    HTH

    PAE

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘can I add html to any php file to add content to a page?’ is closed to new replies.