Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I modified the function a bit, I think it works a little better, you need to put the function inside your functions.php file in the current template directory. This actually uses the callback for only category templates, so don’t need to worry about it affecting anything else.
    Here is the code:

    function child_force_category_template($template) {
    
        $cat = get_query_var('cat');
        $category = get_category ($cat);
    
        if ( file_exists(TEMPLATEPATH . '/category-' . $category->cat_ID . '.php') ) {
            $cat_template = TEMPLATEPATH . '/category-' . $category ->cat_ID . '.php';
        }
        elseif ( file_exists(TEMPLATEPATH . '/category-' . $category->category_parent . '.php') ) {
            $cat_template = TEMPLATEPATH . '/category-' . $category->category_parent . '.php';
        }
        else{
            $cat_template = $template;
        }
    
      return $cat_template;
    }
    add_action('category_template', 'child_force_category_template');

    Forum: Plugins
    In reply to: jquery-ui-core and sliders
    amummey

    (@amummey)

    I am not sure what you mean by wp_enqueue_script doesn’t work at all? I use a slider in my plugin, unfortunately WP doesn’t include the slider code so I have to include it myself from my plugin directory. Just make sure you have the correct JS dependencies:

    if (function_exists('wp_enqueue_script')) {
              wp_enqueue_script('cSpritesCheckbox', trailingslashit(CSPRITE_JS_URL_DIR).'jquery.checkbox.js', array('jquery'), '1.0');
              wp_enqueue_script('jquery-slider', trailingslashit(CSPRITE_JS_URL_DIR).'ui.slider.js', array('jquery', 'jquery-ui-core'), '1.0');
              wp_enqueue_script('cSpriteInit', trailingslashit(CSPRITE_JS_URL_DIR).'csprites.js', array('jquery-slider'), '1.0');
            }

Viewing 2 replies - 1 through 2 (of 2 total)