super-cpt icon indicating copy to clipboard operation
super-cpt copied to clipboard

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

Open sunny04 opened this issue 11 years ago • 2 comments

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!

sunny04 avatar May 15 '14 14:05 sunny04

@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

sixlive avatar May 29 '14 10:05 sixlive

@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.

davegaeddert avatar May 29 '14 15:05 davegaeddert