skip to Main Content

I’m actually trying to modify WooCommerce’s products templates pages by including some shortcodes generated with a page builder, but for my surprise certain CSS files are not linked although the short code has been copied exactly as generated by the page builder, which made me think that the CSS dependencies are stored in the database, and not within the short code.

Would it be possible to include these CSS dependencies into a template page?

Thank you very much.

2

Answers


  1. Chosen as BEST ANSWER

    As far as I've checked the main function used for adding CSS to the final HTML files is: 'wp_enqueue_style' which in my case is being used by my theme to include the required CSS depending upon the usage of certain customs elements. In this case, the procedure of putting the short code into the template, and executing it with the provided function by Wordpress is not allowing said theme to detect the usage of the elements, and therefore the required CSS are not included.

    Thus, the solution for the original question is, in my case, they are not stored in the database, but detected at runtime and injected into the final HTML file through the Wordpress' function wp_enqueue_style.

    CSS dependencies: In this case the CSS which are used for a certain page, are selected at runtime by a PHP system which detects the content of the page, and looks for certain short codes which require certain CSS. Thus, in this case there's no place where the required CSS details for a certain page are stored.


  2. Does your WordPress have a cache plugin? Those can be a pain in the a** when you’re debugging CSS, because the cached CSS is always preferred.

    If not, what I’d recommend you do is if you have a local copy of your wordpress instance, open an IDE and do a "Find in files" search and look for the specific classes/ids you need for your adjustments. Sometimes they are hidden in the least expected places.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search