WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WordPress Popular Posts] Request use of wp_enqueue

[Plugin: WordPress Popular Posts] Request use of wp_enqueue

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Hector Cabrera

    @hcabrera

    Hi alturnwall,

    The wp_enqueue_style function has been implemented already on the development version (not released yet as I’m still reworking some stuff and adding new features).

    About wp_enqueue_script, where should it be applied to?

    Hector, thanks for getting back to both of my posts, and thanks for the great plugin!

    Looking forward to the dev version, and idea when we might be able to grab that code? Or can I get it now from the subversion repo?

    You’re right, wp_enqueue_script should not be used—I was digging through a few plugins all at once and incorrectly copied and pasted that comment here also.

    Thanks again.

    Hello,

    I just implemented this as well…. I did the following:

    after line 123 I added:

    // Enqueue Style Sheet
                            if (function_exists('wp_enqueue_style')) {
                                    wp_register_style( 'wpp-css', plugins_url('style/wpp.css', __FILE__) , array(), $version);
                                    wp_enqueue_style( 'wpp-css' );
                            }

    And then in wpp_print_stylesheet I modified it to be the following, in this way the older functionality is available if necessary.

    // still needed if no enqueue
                            if (!function_exists('wp_enqueue_style')) {
                                    $css_path = (@file_exists(TEMPLATEPATH.'/wpp.css')) ? get_stylesheet_directory_uri().'/wpp.css' : plugin_dir_url( __FILE__ ).'style/wpp.css';
                                    echo "\n"."<!-- WordPress Popular Posts v".$this->version." -->"."\n".'<link rel="stylesheet" href="'. $css_path .'" type="text/css" media="screen" />'."\n"."<!-- End WordPress Popular Posts v".$this->version." -->"."\n";
                            }

    — Edward

    Plugin Author Hector Cabrera

    @hcabrera

    Hi guys,

    @alturnwall the dev version isn’t public yet as it still needs a lot of work.

    @texiwill thanks for sharing your code!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WordPress Popular Posts] Request use of wp_enqueue’ is closed to new replies.