Hi!
I need to insert HTML code in different places on different pages. At the same time, I should be able to change this code at any time. I can’t use hooks for this, so I want to use shortcodes.
I would like to know your opinion:
1. Is it normal to use shortcodes in this case?
2. In your experience, won’t the shortcodes slow down your site?
3. Can you suggest the best shortcode plugin? Now I have found only this one: https://ru.wordpress.org/plugins/shortcoder/, but it has not been updated for a long time.
shortcodes for the classic editor are still the best way for adding ‘global’ content inside your post content. The New Block Editor introduces re-usable blocks that can do the same thing.
They make additional database requests but unless you’re using a lot of them the performance impact should be unnoticable.
What type of content will you be adding? Will the shortcode use arguments/parameters or are they just displaying static HTML?
The problem is that I do not know PHP.
Did I understand correctly what needs to be done:
1. The name of my new shortcode I should write instead of “my_shortcode”.
2. Insert HTML code instead of “short code example”.
3. Install Code Snippets and insert this PHP code in there.
4. On the page insert the shortcode in the right place.
It’s right?
Can CSS be included in HTML?
Above, you mentioned “The New Block Editor” – did you mean Gutenberg?
You can add CSS within the HTML but i would advise against that. Its better to add classes to your HTML and the CSS to your child theme style sheet or Customizer > Additional CSS.