WordPress.org

Forums

Shortcode Reference
[resolved] Paths to CSS and JS don't work on IIS servers (easy fix) (4 posts)

  1. Stephanie Leary
    Member
    Posted 3 years ago #

    I just installed this plugin on a site that's running -- alas -- on IIS, and I noticed console errors indicating that the scripts and stylesheets couldn't load. Your code for determining the plugin paths doesn't work on Windows machines. It was easy to fix using WP's plugins_url function, though. I replaced your wp_enqueue_script and wp_register_style lines in shortcode-reference.php with this:

    wp_enqueue_style( 'shortcode-reference-style', plugins_url('/css/shortcode-reference.css', __FILE__) );
    	wp_enqueue_script( 'shortcode-reference-js', plugins_url('/js/shortcode-reference.js', __FILE__) );

    ... and removed the plugin directory definition and wp_enqueue_style lines from the conf file.

    http://wordpress.org/extend/plugins/shortcode-reference/

  2. Stephanie Leary
    Member
    Posted 3 years ago #

    I made a few more changes to prevent the scripts and styles from loading on the front end. This loads them only on the edit screens:

    function shortcode_reference_scripts() {
    	wp_enqueue_style( 'shortcode-reference-style', plugins_url('/css/shortcode-reference.css', __FILE__) );
    	wp_enqueue_script( 'shortcode-reference-js', plugins_url('/js/shortcode-reference.js', __FILE__) );
    }
    add_action('admin_head-post.php', 'shortcode_reference_scripts');
    add_action('admin_head-post-new.php', 'shortcode_reference_scripts');

    Also, in the CSS file, I fixed a typo on background color in .shortcode_reference_list .shortcode_reference_item.highlight and
    added margin-left: 0 to avoid conflict with WP's built-in .hightlight styles:

    .shortcode_reference_list .shortcode_reference_item.highlight {
    	background: #E4F2FD;
    	margin-left: 0;
    }
  3. Bart Stroeken
    Member
    Plugin Author

    Posted 3 years ago #

    Hey Stephanie,

    Thanks for this! I'll be fixing another thing pretty soon, and I'll include your solution in an upcoming version (expect it somewhere next week).

    Cheers,
    Bart

  4. Bart Stroeken
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Stephanie,

    The new version was just released. Thanks again!

    Bart

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Shortcode Reference
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags