How to edit wordpress code

While WordPress makes it easy for non-coders khổng lồ manage a trang web, there will probably come a time when you want lớn edit code in WordPress to get a little more control over how your site looks or functions.

Bạn đang xem: How to edit wordpress code


To help you vì chưng that, this post will show you how khổng lồ safely edit code in WordPress in a few different ways:

If you already know what you want lớn vì chưng, you can cliông chồng one of the liên kết above lớn jump straight khổng lồ that specific section. Otherwise, let’s get editing!


To get more control on how your WordPress site looks và functions, you can edit your WordPress code khổng lồ customize different areas:

The new blochồng editor và the classic editor allow your lớn edit HTML code for individual posts or pages.If you want khổng lồ edit your WordPress theme’s source code, use a child theme.Consider using a plugin khổng lồ manage code snippets that you add to the or functions.php file of your theme.If you just want khổng lồ add custom CSS, you can use the Additional CSS area in the WordPress Customizer or a plugin lượt thích “Simple CSS”.
Support

How to Edit WordPress HTML for Individual Posts/Pages

Let’s start off with the simplest way khổng lồ edit WordPress HTML – accessing the source code for individual WordPress posts, pages, or other post types.

You can vị this in both the new WordPress bloông chồng editor (Gutenberg), as well as the older classic TinyMCE editor.

Xem thêm: 30+ Best Hotel Resort - 25+ Best Hotel Wordpress Themes 2021

How to lớn Edit WordPress HTML in Blochồng Editor (Gutenberg)

There are a few ways that you can work with HTML in Gutenberg.

First, if you just want to lớn add your own HTML code khổng lồ a piece of nội dung, I would recommend not trying khổng lồ edit the entire source code of your post, as that makes things needlessly complicated.

Instead, you can just use the dedicated Custom HTML bloông chồng and paste the HTML that you want lớn use there:


*

Gutenberg Custom HTML block


However, there also might come a time where you need to lớn directly edit the HTML of a different bloông chồng. For example, if you want lớn add a nofollow tag to a liên kết in the bloông chồng editor, you’ll need khổng lồ edit the HTML of that bloông chồng.

Xem thêm: 30+ Best Free Ecommerce Wordpress Themes 2021 (Updated), Free Woocommerce Themes

There are two ways that you can vị this…

First, you can cliông chồng on the options for an individual blochồng và choose the Edit as HTML option:


*

How lớn edit a single blochồng as HTML


This will let you edit the HTML for just that individual block:


*

Example of editing a block’s HTML


Or, if you want to lớn edit the HTML for your entire post, you can access the Code Editor from the main Tools & Options dropdown. Or, you can also just use this keyboard shortcut lớn toggle between code and visual editing – Ctrl + Shift + Alt + M:


*

How khổng lồ access full code editor in Gutenberg


Keep in mind that, in the full code editor, you’ll have sầu to lớn work around all that markup for blocks – e.g. .

Editing code in WordPress doesn"t have sầu to lớn be hard! Cheông chồng out this easy guide on how to lớn tweak HTML, CSS, and PHP.
Chuyên mục: Theme wordpress