- This topic has 7 replies, 2 voices, and was last updated 2 years, 2 months ago by David.
April 18, 2019 at 2:51 am #872361Vlad
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.
Thanks for your support!GeneratePress 2.2.2GP Premium 1.7.8April 18, 2019 at 3:02 am #872365DavidStaffCustomer Support
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?April 18, 2019 at 3:13 am #872372Vlad
Only html + css.
For example, like this:
<div style="float:left;text-align: center; border: solid 1px red; padding: 20px">image</div> <div style="text-align: center; border: solid 1px red; padding: 20px">text</div>April 18, 2019 at 3:23 am #872374DavidStaffCustomer Support
You could create your own functions:April 18, 2019 at 4:01 am #872393Vlad
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.
Can CSS be included in HTML?
Above, you mentioned “The New Block Editor” – did you mean Gutenberg?April 18, 2019 at 4:09 am #872402DavidStaffCustomer Support
Yes that is correct 🙂
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.
Yes Gutenberg = Block EditorApril 18, 2019 at 4:18 am #872406Vlad
Thank you very much, your support is great.April 18, 2019 at 4:51 am #872418
- You must be logged in to reply to this topic.