• Hello,

    I am attempting to push a new php page to my wordpress using git. The php page is already halfway complete which is why I want to push this instead of using the wordpress page builder to create a new page.

    However, each time I push it, I can’t seem to find the right url to it. Is there a way to push the page to my production website? If so, what folder should I save my php page in before committing it?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @kzohan,

    Is this a php page you are building, that displays the HTML and content within that PHP page? Or are you wanting to use a WordPress template to display content from within WordPress?

    If its the second option check out https://developer.www.ads-software.com/themes/basics/template-hierarchy/ (in particular this diagram https://developer.www.ads-software.com/files/2014/10/wp-hierarchy.png) which shows you how to put together a php page to render a certain part of the theme.

    If it is the first option, if you save the php file within your theme with a name such as my-file.php and you push it into your theme (say that is called my-theme) then your file should be accessible at https://my-domain.com/wp-content/my-theme/my-file.php.

    I hope that makes sense.

    If not, if you could provide a little bit more information I can try and advise further.

    It sounds like you might have some misconceptions about what git is and how it works. You can’t use git to push arbitrary files to arbitrary URLs.

    To use git to push changes a website, you would need to do the following (after asking your host whether you can even run git on your hosting, and how to set it up):

    – Initialise a git repository on your server, in the folder where your code is, probably your theme or child theme.
    – Set up your local computer with appropriate authentication for connecting to the git repository (probably an SSH key).
    – Clone the repository from the server.
    – Make your changes/additions. Commit them to your local repository.
    – Push your local repository back to the server.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Uploading Pages with Git’ is closed to new replies.