Is it possible to edit the code for one of your wordpress pages?

7 replies
Hey guys quick question

Say I add a page to my word press site and then I want to edit the code on that page individually so I can remove and add certain things on that page but it does not effect the others.

Is this possible?

For example, on one particular page I don't want the side bar, but the rest I do.

- Thanks
#code #edit #pages #wordpress
  • Profile picture of the author Big Squid
    Yes. You can accomplish this through the use of templates. Your theme may already have this available. There is a great deal of information about this on Goo-Gull.
    {{ DiscussionBoard.errors[5993772].message }}
  • Profile picture of the author owlfowl
    Off course, here is the option: yourdomain/wp-admin/theme-editor.php
    {{ DiscussionBoard.errors[5997764].message }}
    • Profile picture of the author BlueLayerHost
      First you'll have to figure out the template of the page you want to modify if is something other than page.php.

      Then you can basically copy/paste the code in to a new file called page-nosidebar.php or something similar and at the top of the file you'll need to give your new file a template name so it shows up when you go to make a new page.

      Check out the WP Codex for how to set up the template name.
      Signature
      BlueLayerHost - Shared + Managed VPS Hosting
      BlueLayerMedia - Web Development
      WPMalware - Resource for WordPress Seurity + Exploits
      {{ DiscussionBoard.errors[5998372].message }}
    • Profile picture of the author SteveJohnson
      Originally Posted by owlfowl View Post

      Off course, here is the option: yourdomain/wp-admin/theme-editor.php
      If you want to crash your site when you make a coding error, by all means use the internal theme editor.

      If you make an error in a theme file - and even experienced coders do - it can cause your whole site to go down, including the internal editor. So you've made a goof, saved the file, crashed the site, now you have no way to fix it because you can't even get to the editor.

      When you're modifying theme files, plugin files, etc., do it the smart way - download the file to your computer using FTP. Make a backup so you have a known working copy. THEN make your changes, upload, and test.
      Signature

      The 2nd Amendment, 1789 - The Original Homeland Security.

      Gun control means never having to say, "I missed you."

      {{ DiscussionBoard.errors[5998915].message }}
  • Profile picture of the author Big Squid
    I may also depend on what you want to do with that page, and where you want to edit.

    If, for instance, you're looking to edit solely the "content" of the page, and not your header, say, then you may just not need a template.

    On the other hand, if you want to change something more permanent, like a header, sidebar, or footer, then you'll need to either build a custom page, or a template.

    What exactly do you want to change?
    {{ DiscussionBoard.errors[5998639].message }}
  • Profile picture of the author CPAPJason
    Steve,

    I almost agree, but cPanel --> Legacy File Manager -->upload file and replacing the file that was edited will fix that and allow you to try again.

    Always have your control panel open just for this issue, as I learned the hard way.

    I edit on a home server now though, so if you have an extra system install some form of unix on it and edit right there.
    {{ DiscussionBoard.errors[6000703].message }}
  • Profile picture of the author xrampage16
    If you need to make a landing page for a particular page, what you do can do is create a page, and when you edit it, you will see the "id" of the page that you create. This unique identifier will allow you to override your theme, and make for a different display for just that ID.

    Meaning, that you can copy your page.php file, and if your ID was 1321, you would copy the file to the name...
    page-1321.php
    and you would then be able to edit the template for that particular page.
    {{ DiscussionBoard.errors[6002332].message }}

Trending Topics