• Resolved OsakaWebbie

    (@osakawebbie)


    I’m trying to use the accordian in jQuery UI, which is kinda part of WP. It’s the “kinda” aspect that is giving me problems, I suspect. Following advice on the web, I have this in functions.php:

    function add_accordian_script() {
        if ( is_post_type_archive( 'oicevent' ) ) {
            wp_enqueue_script('jquery-ui-accordion');
        }
    }
    add_action('wp_enqueue_scripts', 'add_accordian_script');

    And in my theme’s js folder I have accordian.js with the following content:

    jQuery(document).ready(function($) {
      $('#accordion').accordion({
        collapsible: true,
        active: false,
    	  heightStyle: 'content',
        header: "header"
      });
    });

    Then I have a template to display an archive of the “oicevent” custom post type. You can see it in action at http://oicjapan.org/events/

    The problem is the link for the CSS. I don’t know where the code is that creates this link, but a literal variable name ($queryui-ver) is jammed in the URL instead of the version number. It’s line 27 of the page source, but here it is for easy reference:

    <link rel='stylesheet' id='plugin_name-admin-ui-css-css' href='http://ajax.googleapis.com/ajax/libs/jqueryui/.$queryui-ver./themes/smoothness/jquery-ui.css?ver=4.0' type='text/css' media='all' />

    It’s as if the PHP code is missing a couple of quotation marks (before the first period and after the second period). But I don’t know where to look for the code, because jQuery UI is not a separate plugin but somehow bundled with WP. Can someone point me in the right direction?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Are you sure that CSS is coming from adding the accordion effect and not from your theme?

    I’d look in the functions.php of your parent theme (startuppro) to see if the stylesheet is enqueued there, and if not there, take a look at the header.php for the theme and see if it’s hard-coded. I don’t think WordPress ordinarily grabs JS or CSS directly from Google; it usually uses what’s bundled in WordPress, and departing from that approach can cause issues.

    Thread Starter OsakaWebbie

    (@osakawebbie)

    Ah! Windows’ search is incompetent! I had been using that to look for occurrences of strings in any files in my themes directory, and was finding several uses of “jquery” but none of “jqueryui”. But just now I switched to using the “Search in files” within Notepad++, and the problem spot came right up. I didn’t notice that apparently Windows looks inside .js files but not .php files. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘jQueryUI CSS link with bare variable in it’ is closed to new replies.