Closed anteksiler closed 4 years ago
Hi,
if you copied the code from the plugin to your theme, why don't you just change the code (change the PT_OCDI_URL to what you want it to be)?
Take care!
Hi @capuderg, I did not copy the code, I just have the plugin files inside the theme, so I do not want to modify the core files.
Can we set a theme mode so that locations:
define( 'PT_OCDI_PATH', plugin_dir_path( __FILE__ ) );
define( 'PT_OCDI_URL', plugin_dir_url( __FILE__ ) );
can be replaced when integrated?
Option-Tree has a theme-mode with the below code:
$path = @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) );
$path = ltrim( end( $path ), '/' );
define( 'OT_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) );
define( 'OT_URL', trailingslashit( trailingslashit( get_template_directory_uri() ) . $path ) );
Hi,
this is a very specific use of our plugin (you are not using it as a plugin, that's why this issue comes up). Why not use TGMPA to recommend the plugin and then change the plugin page to whatever you want?
I have no plans to create a "theme mode", since there was basically no issues opened on this topic.
When we'll create a new plugin version, I'll take a look at the plugin initialization and try to come up with a good solution to this problem (maybe just postpone the plugin init, so that these two constants can be defined in the theme in the after_setup_theme
hook), but I can't say, when that will be time wise...
Take care!
Hi,
In my opinion it is a very logical step to integrate this plugin into a theme, since it was basically built for theme distribution. In other words, I have the same issue :-)
Did either of you find or build a solution to tackle this? I would love to supply the functionality of this plugin in my theme without the need for clients to first install the plugin.
Thx!
Hi,
It's almost never a good idea to bundle the non-theme related functionality code into the theme.
Hi there, I am integrating the plugin inside the theme, so I need the plugin assets in another page.
I commented out the page check inside admin_enqueue_scripts, however PT_OCDI_URL is returning the wrong url. Is there anyway to filter it so that it gets the current location of the file?