• Resolved christianitaly

    (@christianitaly)


    Good morning Ben,

    i have a little problem.
    I want to create a page with title “Who we are” that explain some details about my website.
    To move, i created a new file.php named WhoWeAre.php with this code:

    <?php get_header();
    get_template_part( 'content/archive-header' ); ?>
    
       /*here i want to write all the details of the site */
    
    <?php get_footer(); ?>

    The only elements i’d like that appear on my WhoWeAre file are header and footer.

    Then in the credit session of the foother.php i added an <a href="">WHO we are</a> tag and i would like that it point to the page that i previous created.

    I added the page-file inside the mission-news theme folder in the database via FTP.

    My problem is that i’m not able to link the a-tag to the file. That’s to say i don’t know how to associate a permalink to the file that goes inside the database and catch the page i’ve created.
    I tried to write the href in this way: “https://www.italy-press.com/WhoWeAre&#8221; but it doesn’t work. He recall 404error.php file.

    It would be more simple if i had simply created a new page in the backend section.

    But i would like to learn how to do it manually, can you help me?
    thank you very much, and sorry for inexperience.

    Christian

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Ben Sibley

    (@bensibley)

    Hey Christian,

    I think a “page template” would be the perfect solution for this. You can add a comment at the top of the file like this to make it into a page template:

    <?php 
    /* Template Name: Example Template */ 
    
    get_header();
    
    get_template_part( 'content/archive-header' ); ?>
    
       /*here i want to write all the details of the site */
    
    <?php get_footer(); ?>

    Then you can publish a new page on your site and in the right-side of the editor, you’ll see this template drop-down selector: http://pics.competethemes.com/pSeA. You’ll be able to select the template from there and the content displayed will be whatever you placed into the template PHP file.

    I would also recommend placing this file into a “child theme.” If you place the file into the Mission News theme folder via FTP, it will get deleted whenever you update to new versions of Mission News.

    You can find some basic info on child themes and a Mission News starter child theme here: https://www.competethemes.com/help/child-theme-mission-news/

    And here’s some more info about using page templates with WordPress: https://developer.wordpress.org/themes/template-files-section/page-template-files/

    Thread Starter christianitaly

    (@christianitaly)

    Thank you very much Ben! Thanks for solutions

    Theme Author Ben Sibley

    (@bensibley)

    You’re welcome 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add manually a new file / page on theme’ is closed to new replies.