• Hey guys!
    I’m fairly new to wordpress but I’m an experienced developer and can learn quickly. I wanted to know if there is a way to add HTML content to an already existing page. I know how to modify some pages to add html, but I want to add a landing page section on a page that is already published. The header is already coded into the page and I can’t seem to find out how to add content before the header.php or header theme. I want to make the new section appear above the existing header section… on top of the header section. Can I just make changes to the header.php file? or do I have to make another php theme and change the structure of it?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hello, both ways that you mention would be valid either making a new template file for that page only or using the is_page() in the existing header.

    Since we are talking about only a header addition I would personally go for the is_page() above the main header.

    Basic idea :

    <?php
    if ( is_page( 'my-page' ) ) {
     echo 'you reached my-page';
    }
    ?>

    This echo would only be shown on the page that has a slug of ‘my-page’. Pretty easy and handy.

    You can find further information at https://developer.wordpress.org/reference/functions/is_page/ .

    Also if it is not a fully custom template it would be wise to create and use a Child Theme. This way your original theme will always stay intact and you can refer back to that code if needed https://codex.wordpress.org/Child_Themes .

Viewing 1 replies (of 1 total)

The topic ‘Adding new content to existing page’ is closed to new replies.