Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author David Cramer

    (@desertsnowman)

    I have thought of doing that but the problems lie in that the CSS accepts dynamic tags {{attribute}} so that you can use the attributes to change colours or sizes. If i where to save it in a temp file then it wouldn’t be able be dynamic.
    The other option would be to have the CSS generated linked via a PHP file, however this too has the drawback of adding an additional processing query to your server.

    You could put your CSS code into a static file your self, upload it then link it to your library.
    then for the dynamic stuff place that in your CSS tab.

    In Caldera Engine, (the pro version) the header CSS is compressed and minimised to try reduce load. (not a plug just saying)

    I will explore options and see what I can do to help out.

    Thread Starter ClubMagellano

    (@clubmagellano)

    Ok. Have you considered to write the css to a php file which create a css file?
    I have a theme doind this on one of my sites.

    This is the content of the style-custom.php

    =======================START FILE
    <?php
    	/*
    	*---------------------------------------
    	*	This file fetch all style options in admin panel to generate the css
    	*	to attach to header.php file
    	*	--------------------------------
    	*/
    
    	header("Content-type: text/css;");
    
    	$current_url = dirname(__FILE__);
    	$wp_content_pos = strpos($current_url, 'wp-content');
    	$wp_content = substr($current_url, 0, $wp_content_pos);
    
    	require_once($wp_content . 'wp-load.php');
    
    ?>
    CSS stuff here
    ========================END FILE

    What do you think?

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

    Plugin Author David Cramer

    (@desertsnowman)

    Indeed I have. I even had it in version 1.8b for testing. I found that the lack of caching and having another link which starts another thread is no better than having minimized CSS in the header
    Personally I don’t like it.

    However, and you may like this, I have been playing with it and I do have made a solution. Which is coming in the next update.

    When you create insert a new shortcode, it writes a cache file of the current instance of your shortcode as a solid file and includes it as a normal css file. The file name is a hash of the overall code and the instance of attributes. Files are also timestamped and removed after a few days in case the instance has been removed or updated. This is so over time you don’t build up unused files.

    The update is coming in a few days with a whole heap of new features.

    I do thank you for actively helping and suggesting useful ideas.

    Thread Starter ClubMagellano

    (@clubmagellano)

    You’re welcome, I’m exited for the next update! ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: My Shortcodes] Integration of CSS in head’ is closed to new replies.