Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 errors for kirki css and js files on localhost #1309

Closed
mapsteps opened this issue May 3, 2017 · 8 comments
Closed

403 errors for kirki css and js files on localhost #1309

mapsteps opened this issue May 3, 2017 · 8 comments
Labels
Milestone

Comments

@mapsteps
Copy link
Contributor

mapsteps commented May 3, 2017

Issue description:

I'm getting 403 errors on a local machine (windows) using UwAMP with PHP7. I embedded kirki in the theme as mentioned here: https://aristath.github.io/kirki/docs/advanced/integration.html

Version used:

3.0.0-beta.1

Attachments:

18193198_1678057739166027_4421741195562371260_o
18216827_1678052835833184_4296797516582704925_o
18238575_1678053305833137_8067459839092666002_o

@AdsonCicilioti
Copy link

Did you use the function to update the path of the files?

I saw that you placed KIRKI manually in the /assets folder of your theme. Then the function should point to it. Try this:

if ( ! function_exists( 'my_theme_kirki_update_url' ) ) {
    function my_theme_kirki_update_url( $config ) {
        $config['url_path'] = get_stylesheet_directory_uri() . '/assets/kirki/';
        return $config;
    }
}
add_filter( 'kirki/config', 'my_theme_kirki_update_url' );

@mapsteps
Copy link
Contributor Author

mapsteps commented May 4, 2017

Hey @AdsonCicilioti,

thanks for your fast response! Of course that did the trick, totally overlooked it.

Thanks!

@mapsteps mapsteps closed this as completed May 4, 2017
@aristath
Copy link
Contributor

aristath commented May 7, 2017

Reopening this one.
Using the filter should not be necessary...
Unfortunately I don't have a Windows machine to test and debug these kind of issues so it's just going to take a bit longer 'till I manage to setup a proper Virtual Machine for Windows tests.

@aristath aristath reopened this May 7, 2017
aristath added a commit that referenced this issue May 7, 2017
@aristath
Copy link
Contributor

aristath commented May 7, 2017

I hate Windows...
So far I was unable to build a proper dev environment on a Windows VM, so I pushed a commit that - in theory - should fix some of the issues you're having.

Can you please remove the filter you previously added and test if that last commit fixes your issue?

If it does not, then please add the following in your functions.php file and paste here what the results in your screen are:

add_action( 'wp', function() {
	var_dump( 'Kirki Path: ' . Kirki::$path );
	var_dump( 'Kirki URL: ' . Kirki::$url );
	var_dump( 'Template Path: ' . get_template_directory() );
	var_dump( 'Template URL: ' . get_template_directory_uri() );
	var_dump( 'Stylesheet Path: ' . get_stylesheet_directory() );
	var_dump( 'Stylesheet URL: ' . get_stylesheet_directory_uri() );
	var_dump( 'ABSPATH: ' . ABSPATH );
	var_dump( 'KIRKI_PLUGIN_FILE: ' . KIRKI_PLUGIN_FILE );
	var_dump( 'plugin-dir-url: ' . plugin_dir_url( KIRKI_PLUGIN_FILE ) );
});

This should help me figure out what to do 👍

@aristath aristath added the bug label May 7, 2017
@aristath aristath added this to the 3.0 milestone May 7, 2017
@mapsteps
Copy link
Contributor Author

mapsteps commented May 8, 2017

Hey @aristath,

thanks! That error ocurred on one of my customers machines. I'm also on a mac and unable to recreate it. Let me send him the latest version of the theme and try to get his feedback.

Best,
David

aristath added a commit that referenced this issue May 8, 2017
@aristath
Copy link
Contributor

aristath commented May 8, 2017

OK, I was finally able to setup my dev VM, tested it, replicated the issue, found another bug, pushed a fix and now everything works fine on Windows localhosts when the plugin is embedded in a theme. 👍
Please note that if you sent the files to your customer before this last commit I just pushed the bug is still there, it just got fixes 5 minutes ago.

Closing this one again, hopefully for the last time!
The filter is no longer required, Kirki will find if it's in a theme, child-theme, or installed as a plugin and it will use the correct URLs depending on the installation.

@aristath aristath closed this as completed May 8, 2017
@mapsteps
Copy link
Contributor Author

mapsteps commented May 8, 2017

You're the man! Thanks!

@AdsonCicilioti
Copy link

AdsonCicilioti commented May 8, 2017

Nice work @aristath!... Remember to update documentation on site!
Or this is only for version 3?

aristath added a commit that referenced this issue May 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants