J
J
JyriG2018-08-26 20:03:37
WordPress
JyriG, 2018-08-26 20:03:37

How to make php work in wordpress page editor?

Good afternoon, I insert the code into the vp page editor, html works, and php comments on the browser. Why?
5b82dcdebfcfe120745471.png
Here is an example from the console. The code was not originally like this.
How to make the function work? (You need to display post thumbnails. If php cannot be inserted into the page editor, is it possible to display thumbnails in another way?)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2018-08-26
@JyriG

Hello!
1) It is strongly not recommended to insert PHP code into the editor. But if you really want to, then the Exec PHP plugin or Allow PHP Execute (I don’t know if they work, because they are outdated).
2) The correct way to add a PHP code on a page is by creating a shortcode, and insert the shortcode into the content. More details - https://wp-kama.ru/function/add_shortcode
Or you can insert PHP code into a template and assign this template to a page or post...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question