- This topic has 7 replies, 2 voices, and was last updated 3 years, 11 months ago by
David.
-
AuthorPosts
-
April 18, 2019 at 2:51 am #872361
Vladimir
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.Thanks for your support!
GeneratePress 2.2.2GP Premium 1.7.8April 18, 2019 at 3:02 am #872365David
StaffCustomer SupportHi there,
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?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 18, 2019 at 3:13 am #872372Vladimir
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 #872374David
StaffCustomer SupportYou could create your own functions:
https://docs.generatepress.com/article/creating-a-shortcode/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 18, 2019 at 4:01 am #872393Vladimir
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?April 18, 2019 at 4:09 am #872402David
StaffCustomer SupportYes 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 Editor
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 18, 2019 at 4:18 am #872406Vladimir
Thank you very much, your support is great.
April 18, 2019 at 4:51 am #872418David
StaffCustomer SupportGlad to be of help
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.