Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

pt-br:Editando Arquivos

Há momentos em que você terá que editar os arquivos do WordPress, especialmente se você quiser fazer mudanças em seu Tema WordPress. O WordPress possui um editor embutido para editar arquivos de dentro de seu navegador, enquanto on-line. Você também pode editar arquivos copiados ou armazenados em seu computador e depois transferi-los para o seu site usando um Cliente deFTP.

Antes de editar qualquer um dos seus arquivos do WordPress, verifique o seguinte:

Cópias de Segurança! E trabalhe a partir Backups
Trabalhe a partir de cópias de arquivos de backup, quando possível e/ou tenha certeza que você faça backups freqüentemente enquanto faz alterações. Mantenha os backups em um local seguro.
Mudando Permissões de Arquivos
Ao trabalhar online, você precisa configurar as permissões de arquivo adequadamente para ser capaz de modificá-los e salvá-los. Se você vê uma nota na parte inferior do Editor do WordPress dizendo:"Se este arquivo foi writable você poderia editá-la .", isso significa que você precisa alterar as permissões do arquivo antes de fazer quaisquer alterações.
Use um Text Editor para editar arquivos
para fazer alterações em arquivos fora do editor, use um editor de texto simples como o Bloco de Notas ou o NotePad++. NÃO use processadores de texto, porque estes editores como Word ou Frontpage, mudam as aspas e outros caracteres que interferem no código.

Editor de Tema e Editor de Plugin

WordPress contains two built-in editors that allows you to edit Theme files directly from within your browser. They are called the Theme Editor and Plugin Editor.

Access the Theme Editor from the Administration > Appearance > Editor menu.

The Plugin Editor is located at Administration > Plugins > Editor.

To view a file in these editors, click on the file from the left-hand side list.

More information on editing themes is available at Theme Development and Using Themes.. You can learn more about editing plugins at Writing a Plugin and Plugin Resources.

What Files Can Be Edited?

From within the WordPress Built-in Editor, the following file types may be edited, if writable:

  • HTML
  • PHP
  • CSS
  • .htaccess
  • TXT (and related text-like files such as RTF)

Importante

Acentuações
O WordPress por ser escrito em PHP não reconhece acentuações, do mesmo modo que páginas HTML, você deve informar o Código do caractere. Assim, se quiser traduzir o termo Comentário, você deve usar Comentário.
Pesquisa 
O Editor do WordPress não possui pesquisa de termo, você pode usar a pesquisa do seu navegador. Geralmente no menu em Editar.
File Permissions 
To edit a file through the Built-in Editor, the permissions for that file must be set to 666. You can change the permissions on files by using a FTP client program, web-based interface provided by your host, or from the command-line using telnet or ssh (secure shell). These options are dependent on the type of access your host offers.
Instant Changes 
The changes you make in the WordPress editors are instant and you do not need an FTP client program. You are changing the files online. You and visitors will see the changes immediately.
Make a Mistake? Use the Backup Files 
Backup all files before editing. If you make a mistake, copy the file back onto your site from the backed up files. No backup? You will need to download WordPress, your Theme, and whatever files you need to replace and start over. BACKUP FIRST.
Make a Bigger Mistake? Delete 
If the changes you make cause your site to "crash" or gives you a blank screen or screen filled with errors, if you cannot access your Administration Panels, delete the changed file and replace it with a good one from your backup.

Editing Files Offline

To edit files offline on your computer, you can use any text editor, open the file and make changes. Again, be sure the original file is backed up!

It is not recommended to change core WordPress files other than wp-config.php; if you must change anything else, take notes and store them in a text file in your WordPress root directory and make a backup copy of them for future reference and upgrades.

After saving the file, upload it to the appropriate folder on your WordPress site using an FTP client. Then view the results in your browser to check if the desired change has taken effect.

Use Caution With These Editors

If you use any editor that is not a text-only editor, can corrupt the file you are editing. Examples of editors to completely avoid include:

  • ANY word-processor, such as:
    • Microsoft Word
    • WordPerfect
    • OpenOffice
    • Apple iWork Pages
  • Microsoft Publisher
  • ANY Do-It-Yourself Instant Web Page Software

Use these only if you are very familiar with them:

Dreamweaver
It's best to copy from the WordPress editor, replacing what Dreamweaver puts in new files by default.
FrontPage
watch out for extra code inserted by FrontPage, and don't try to use its built-in templates ... also watch for IE-specific code which can make your site look or act unexpectedly in certain browsers, which you want to stay away from, because you want your website to be viewable in ALL browsers possible, so make sure you take out the IE-specific code, or else your blog will be doomed to failure. So, just watch out all the time for all IE-specific code, and DELETE it immediately, or else your blog will be dooomed to failure.

Recommended editors are listed at the Editor de Texto