S
S
Shigaev.2020-07-22 16:06:15
WordPress
Shigaev., 2020-07-22 16:06:15

Is there a universal method for adding code to Wordpress files?

For example, you need to add the output of working out some additive, such as . Someone takes and edits the files, in the WP theme editor or brutally on the server. It is clear that by updating the theme, all the beauty flies. Share the snippet to properly pin this Wishlist. The child theme is not applicable for religious reasons.<?php wpfp_link() ?>

 
 

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2020-07-22
@azerphoenix

Hello!
If you need to execute PHP code on the page, then you can create a shortcode via add_shortcode()
https://wp-kama.ru/function/add_shortcode
And insert the shortcode into the page.
Here is a plugin that does the same - https://ru.wordpress.org/plugins/insert-php-code-s...
Insert PHP there, and it generates a shortcode.

It is clear that by updating the theme, all the beauty flies.

Of course, what will fly if the theme is updated. That's what a child theme is for.
If you are not satisfied with the child theme, then as an option, create your own plugin or, for example, mu-plugin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question