At Long Last – Arconix Shortcodes v1.1

It’s been a while since I’ve updated my shortcodes plugin, and I spent this latest release primarily adding user-requested features. One of the most requested enhancements for this round was adding a compatibility mode to the plugin. With all the other plugins and themes in the WordPress universe that happen to use the same shortcode names as my plugin, a compatibility mode would allow similarly named shortcodes to coexist in peace. Turning on compatibility mode is very easy. Just a simple line added to your theme’s functions.php file

define( 'ACS_COMPAT', true ); // Arconix Shortcodes Compatibility Mode

That will prefix all shortcodes with ac-. For example, if I wanted to use the box shortcode, instead of using [ box ]My box content[ /box ], I’ll use [ ac-box ]My box content[ /ac-box ].

This does not change any existing shortcode text, so if you’re turning on compatibility mode after you’ve already been using this plugin, you’ll need to edit the posts/pages, etc… and rename the shortcodes to the proper name.

The other big user-requested item was adding some other way to remember all the shortcodes instead of always having to load the documentation. The result of this is I’ve added a meta box to the post and page edit screens that lists all the shortcodes. That list also honors the compatibility mode setting, so it will display those shortcodes correctly if you’ve turned compatibility mode on. If you’d like to add that meta box to other content types that you may have enabled on your website, that list can be modified with a filter.

The other two updates are minor for most people, but anyone who needs to override the version of the jQuery Tools script will appreciate that instead of having to modify core plugin files (and re-modify them when I update the plugin), they can do so through their functions file and not worry about it breaking in the future. The other update was for anyone that likes to peek around the source code and see how it all works — I’ve heavily updated the inline documentation, and while it may not be perfect, it’s a lot better and should be much easier to follow.

As usual, let me know what you think or if you run into any issues.

  • I am glad that I can now run arconix beside other jQuery plugins, but have run into a problem with this fix for accordions. The fix works, until I add an [ac-accordions] code.

    • Hi Aaron,

      Could you explain the problem you’re having with the accordion script when using compatibility mode?

      • If you visit my test page http://apwainman.com/tabs-testing-in-pages/ you will see what I mean. Your fix worked when I used tabs but not when I used accordions, and not when I put an accordion within a tab.

        • I have compatibility mode enabled currently at http://arconixpc.com. You can tell because if you visit the Buttons page, the unprocessed button shortcode is there, but the accordion page is working, including putting an accordion inside a tab.

          When you close the shortcode, are you closing them with the ‘ac-‘ in front, i.e. [ /ac-tab]?

      • Also, this is the js error I am seeing in my console.log

        Viewport argument value “device-width;” for key “width” not recognized. Content ignored. /tabs-testing-in-pages/:14
        Uncaught TypeError: Cannot call method ‘create’ of undefined chrome-extension://aonjhmdcgbgikgjapjckfkefpphjpgma/measureIt.js:120
        (anonymous function)

        • measureIt.js isn’t a script that I’m providing in my plugin. It sounds like it might be coming from the theme?

          Additionally, when I look at the console log on the test site, it’s empty.

  • Darren

    Just a quite comment to say that I absolutely love this plugin, it’s fantastic! Good work John, and thank you for all the time you put in.

    • Thanks Darren, I appreciate the kind words

  • The filter-setting for jquery is simply wonderful. Today we lost access to jquerytools.org and thus the jquery linked to by Arconix. A quick fix…

    function arconix_use_local_scripts($args) {
    $args['url'] = '/jquery/1.2.7/tiny/jquery.tools.min.js';
    wp_register_script( 'jquery-tools', esc_url($args['url']), array($args['dep']), $args['ver'], true );
    }

    add_filter('arconix_jquerytools_reg', 'arconix_use_local_scripts');

    …in functions.php loads a local version instead. Clean and wonderful; good thinking making the filter :-).

    • Hi Thomas,

      Thanks for the kind words. Just a note for others who may stumble on this, the below is the recommended way of accessing that filter:

      function arconix_use_local_scripts( $args ) {
      $args['url'] = '/jquery/1.2.7/tiny/jquery.tools.min.js';
      return $args;
      }
      add_filter( 'arconix_jquerytools_reg', 'arconix_use_local_scripts' );

      Since the purpose of a filter is to modify values, we take all the parameters passed into the script registration, modify the ‘url’ parameter and then return the collection of params for WordPress to continue processing.

  • So, I’ve been transitioning out of a web master role and just today noticed that the toggle wasn’t working on the site. They all seem to be in a constant expanded state and don’t collapse.

    I use it on a number of pages. Not sure if it’s related to WP updates or something else.

    http://www.citychurchdenver.com/our-staff/
    http://www.citychurchdenver.com/family/
    http://www.citychurchdenver.com/serve-city/
    http://www.citychurchdenver.com/serve-world/

    Suggestions? Help?

    • Hi Jeff,

      It sounds like there’s some kind of javascript conflict or error that’s causing the issue. I see that jQuery is only loaded once, and my script file is loading, which is good. The only way to narrow down the issue is to disable your other plugins one by one until you find out which one is causing the conflict. I do see some javascript errors in the console and they look like they might be coming from Jetpack, so that might be the first one to disable. If you’ve disabled all your plugins and the issue remains, then try switching to a theme such as TwentyTwelve and see if the issue persists. Once you find out which plugin is causing the conflict, let me know and I can look into it and see what might be happening.

      • Looks like it was Jetpack. However, somewhere in there I lost some of my CSS…. hmmmmm. Something else to fix 🙂 Thanks for your quick feedback.