reduxframework / redux-framework

Redux is a simple, truly extensible options framework for WordPress themes and plugins!
http://redux.io
Other
1.73k stars 582 forks source link

Symlink for static assets issue #3382

Closed calebfaruki closed 7 years ago

calebfaruki commented 7 years ago

Our company has Wordpress installation hosted on AWS with Engine Yard config. We have a symlink to /wp-content/ to a shared folder that is preserved when we update. I noticed your ReduxCore/framework.php file accounts for symlinks to plugins, but not for static assets.

By the way, I'm using a Wordpress theme that uses your framework. Do you have any recommendations for how to fix?

Relevant theme file: /wp-content/themes/voice/include/options/ReduxCore/framework.php:129

Added line to 128:

self::$_url = str_replace('/data/blog/shared/wp-content','',self::$_url);

This is obviously a hack. But it fixed the problem for me.

kprovance commented 7 years ago

We have a filter for self::$_url. Use add_filter with redux/_url as the tag. Then you may specify and URL you like. That's about as close a fix as will ever be for those rare situations like this. Good luck.

calebfaruki commented 7 years ago

Ah perfect, thank you very much! Your answer lead me to this article which allowed me to solve my issue.

For anyone else needing a fix on this, here was my solution:

<?php

// define the redux/_url callback
function filter_redux__url( $self_url ) { 
    // make filter magic happen here... 
    return str_replace($symlink_path_substring,'', $self_url);
}; 

// add the filter
add_filter( 'redux/_url', 'filter_redux__url', 10, 1 ); 

?>