mboynes / super-cpt

**DEPRECATED.** Left public for posterity.
223 stars 49 forks source link

Embedding SuperCPT in a theme creates 403 error for the css and js files #42

Open sunny04 opened 10 years ago

sunny04 commented 10 years ago

Hi,

I'm creating a theme and I'm trying to use SuperCPT by embedding it in the theme, by calling the super-cpt.php file from the functions.php. However I get 403 error for the supercpt.css and supercpt.js files, perhaps it's to do with how the files are loaded in the SuperCPT core.

Would really love it if this can be resolved, as it is really important for me. Thanks!

sixlive commented 10 years ago

@sunny04 @davegaeddert

I just updated the following code in the super-cpt.php

if ( !defined( 'SCPT_PLUGIN_URL' ) )
    define( 'SCPT_PLUGIN_URL', get_template_directory_uri() . '/includes/super-cpt/' );

I keep mine in foo-theme/includes

davegaeddert commented 10 years ago

@sixlive mind giving this a try?

if ( !defined( 'SCPT_PLUGIN_URL' ) ) {
    if (strpos(SCPT_PLUGIN_DIR, get_template_directory()) !== -1) {
        define( 'SCPT_PLUGIN_URL', str_replace(get_template_directory(), get_template_directory_uri(), SCPT_PLUGIN_DIR) . '/' );
    } else {
        define( 'SCPT_PLUGIN_URL', plugins_url( '', __FILE__ ) . '/' );
    }
}

That's what I did in #43, I think it should work in all cases...but it'd be good to know if it doesn't for some reason.