Is it possible to rename or redirect the plugins/child[] directories to change plugin names for Google or source code view?
Wordpress obviously relies on wp-content and it's children to run, but I'm curious if it's possible to rename the children of plugins using .htaccess or another means.
I've experimented with variations this:
`Redirect 301 /path/to-old-url http://www.yourdomain.com/path/to-new-url`
...but that comes back to an actual redirect header response which I can't have.
I'm hoping it can be done and still have Wordpress function and update themes and plugins normally, but I'm not that savvy using .htaccess and I've blanked my site several times trying different things.
Any pointers or help would be really appreciated. :)
EDIT: What I'm trying to do is change the visible plugin/child directory name only. Not change the directory Wordpress accesses for plugins/name - having the revised plugin/name visible is not a problem.
OK, add this in wp-config.php, and it should do what you need, replacing 'apps' with the directory you want to serve from, and moving the plugins to the same directory on the server.
define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/apps' );
define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/apps' );
(Initial responses before fully understanding the question.)
Not really.
You could use this WP Hide & Security to hide the plugin path /wp-content/plugins/ and rewrite that to something else, e.g., /apps/ ...but the NAMES of the plugins would still be visible.
The only way I could think of not showing the plugin names would be to directly include them in your theme via php includes, and strip out all the css/js that the plugin adds and incorporate that into your theme.
However, that likely would break the plugin, and even if you could get it working correctly, there would be now way to update said plugin in the future....(and of course that would make your site terribly hard to support so it's not recommended at all.)
I have been trying to figure this out for the past couple of hours, but how do I integrate the plugin into a wordpress site?
Because the plugin itself does not have a specific directory to be placed, I am confused as to where the files need to be put in order for it to work. My explanation is pretty vague, as I haven't been able to upload any of the 3 files mentioned into wordpress as of yet.
so there are 3 files:
jquery.magnific-popup.js/ jquery.magnific-popup.min.js/ magnific-popup.css
The end product i need is essentially just a set of gallery items, not restricted by width or height, so I am able to have a website similar to this one here as reference: http://www.three-d-conceptwerke.com/
Each Gallery item opens a pop up that displays several images within each gallery, in which case each item is treated as a project containing several images.
That aside, without knowing how to integrate the files into wordpress, I am unable to work on it. Any clues?
It doesn't matter where you place them - just call the scripts and stylesheets in your header or add them into your functions.php.
E.g. if I uploaded them into a directory called external-plugins, I would just call them as
<link href="http://www.example.com/external-plugins/magnific-popup.css"> <script src="jquery.magnific-popup.min.js"></script>
And add your arguments below. Should work fine in your header.php
Edit: That link you posted pretty much explains everything you need to do - if you can't follow it, maybe you should hire somebody else to do it for you!
The instructions are pretty clear from the link you provided...
Create the directory magnific-popup in your theme’s directory. Download the MP CSS and JS files from GitHub and put both in the magnific-popup directory
You need either use an FTP client like Filezilla or use a File Manager from your hosting control panel to log into your site's file directory. Once you are there, navigate to your WordPress theme's directory wp-content/themes/your-theme/ and create a new directory named magnific-popup. Then upload your 3 files into that directory and follow the rest of the instructions to finish setting up your popup.
If you've found this helpful please mark this as the acceptable answer to your question.
I'm using the wedevs-dokan-plugin (wedevs.com/dokan) for a WordPress frontend user store, which allows sellers to manage their store from the frontend.
I want to override one of the template files of this plugin. The file which I want to override is located at:
plugins/wedevs-dokan-plugin/templates/product-edit.php
And to override this file, I copied the file and made some changes, putting this new file in the theme directory like this:
themes/mytheme/wedevs-dokan-plugin/product-edit.php
But this isn't working for me. After that I also tried:
themes/mytheme/wedevs-dokan-plugin/templates/product-edit.php
But that's also not working.
Is there any way to override the plugin files from within a WordPress theme?
themes/mytheme/wedevs-dokan-plugin/product-edit.php
Instead of "wedevs-dokan-plugin" the directory name should be "dokan" and you can only edit the "templates" directory files of this plugin.
So, the new directory will look like these.
themes/mytheme/dokan/store.php
themes/mytheme/dokan/dashboard/dashboard.php
Thanks
I'm trying to reverse-engineer a plugin : http://wordpress.org/extend/plugins/wordpress-social-login/
In a part of it, there's this line:
(I'm having a hard time understanding the first one, the rest are simply there for reference if they have something to do it.)
require_once( dirname( dirname( dirname( dirname( __FILE__ )))) . '/wp-load.php' );
define( 'WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL', plugins_url() . '/' . basename( dirname( __FILE__ ) ) );
define( 'WORDPRESS_SOCIAL_LOGIN_HYBRIDAUTH_ENDPOINT_URL', WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/hybridauth/' );
My question is... what exactly is in this wp-load.php file that it needs to be required by the code? By looking at it, all I understand is that it loads crucial core wordpress files for the site to be running correctly (functions.php, wp-settings.php, wp-config.php etc...)
Doesn't the fact that the plugin runs already means wp-load.php is loaded?
Also it's a complete waste of resources since it includes so many files that may include other files as well and it's like an endless loop of required files, each within another, which are being loaded twice.. (or even more if other plugins use this kind of method too)
So what exactly does it do?
P.S; All I found by Google-ing is HOW to include it correctly (since paths are change-able) - but that's not my problem/question.
My question is... what exactly is in this wp-load.php file that it needs to be required by the code?
All of the core WordPress functionality. This includes the theme files, all the files of active plugins, etc. BUT loading WordPress in this way doesn't parse the requested URL and doesn't run the WordPress query(by initializing the WP object, nor the WP_Query objects).
By looking at it, all I understand is that it loads crucial core wordpress files for the site to be running correctly (functions.php, wp-settings.php, wp-config.php etc...)
Yes, you've understood correctly.
Doesn't the fact that the plugin runs already means wp-load.php is loaded?
If the plugin code was invoked by WordPress(for instance in order to display an admin page, or it was included by the initially loaded plugin file) - then yes, it means that wp-load.php has already been loaded.
Sometimes though, plugins direct requests to single files(for instance http://example.com/wp-content/plugins/my-plugin/sample.php), instead of to some WordPress-powered page(for instance http://example.com/?my_plugin_action=sample or http://example.com/wp-admin/admin-ajax.php).
See how the first URL references a specific file in the my-plugin plugin directory and the second one goes to the home page of the site with a specific query argument added, or the third example, where the referenced file is admin-ajax.php in the wp-admin directory - this is a special file, which makes it easy for plugins to make AJAX request(this file also loads the WordPress core and fires some action hooks).
In the case of the first reference, if the plugin wants to use some WordPress functionality(for referencing the database, manipulating posts, etc), it needs to load the WordPress core files by including wp-load.php.
Also it's a complete waste of resources since it includes so many files that may include other files as well and it's like an endless loop of required files, each within another, which are being loaded twice.. (or even more if other plugins use this kind of method too)
Note the _once part in require_once(... - this tells PHP to include the file only if it hasn't been included already. Therefore no conflicts will occur, and not too much memory will be used by PHP. Although - if you are in a context where WordPress has already been started, you shouldn't call the require function.
So, basically the plugin author expects some requests to be made to the plugin file in which you found this code. Since the author wants to use WordPress functionality in this file, he invokes the wp-load.php file in order to load the core functions.
I assume, that this is done in order to reduce load on the server, although with a couple of hooks that run on the plugins_loaded action hook and a custom $_GET parameter added to the home url, the result should still be pretty close.
I personally prefer the second option, but like I said, including wp-load.php will prevent WordPress from running some complex stuff(URL parsing and database query/ies).
If there is still something, that you don't quite understand about that - post a comment here and I'll try to explain further.
wp-load.php is responsible of bootstrapping the WordPress environment which make the plugin able to use the native WordPress Core function.
Now as for
Doesn't the fact that the plugin runs already means wp-load.php is loaded?
Not at all!
If you access a plugin file directly it doesn't mean that you have the whole WordPress environment and you are not able to use the native core functions unless you include wp-load.php.
This will include wp-load.php if not already loaded if the file is located anywhere, regardless of level, within the wp-content directory.
if(!defined(ABSPATH)){
$pagePath = explode('/wp-content/', dirname(__FILE__));
include_once(str_replace('wp-content/' , '', $pagePath[0] . '/wp-load.php'));
}
From what I read they usually include wp-load in the plugins when database usage is needed, but this is a bad choice as it raises a lot of problems.
You can see some relevant articles in here:
http://ottodestruct.com/blog/2010/dont-include-wp-load-please/ ( if this link is ever deleted, See that page here )
wp-load.php is one way to load WP from external scripts, allowing the use of WP functions among other features.
But, as you say, that should not be necessary as it is a plugin. Nevertheless, you don't explain where did you find the code in your question, because wp-load.php is indeed needed for front-end pages or scripts located in a directory different from the style sheet directory, for example, even when they are part of a plugin.
Plugin pages in the admin area don't have to reload WP because it is already loaded, but front-end pages do have to load it.
In short, there are several reasons to include wp-load.php to have access to WP functions and variables.
Probably a double check.
require_once() means that if it has already been loaded, then it will not load again.
I have one instance of Wordpress Multiuser and need ShareThis plugin to be automatically activated in all new created blogs.
I've seen a post:
Plugins placed in wp-content/mu-plugins are automatically enabled for all blogs in the system. They cannot be turned off by the users.
When putting the plugin files into root blog (/plugins/ folder), the plugin is functional, but when putting it into /mu-plugins , the plugin is not working.
What else do i need to do to make it work?
Plugins put in /mu-plugins cannot be in folders.
/mu-plugins can only contain plugin files like what-ever-plugin.php.
The mu-plugins directory will not read plugins in a subfolder, so your ShareThis plugin must be modified to individual file to work.
Any plugin files in a subfolder will be ignored unless included in the primary plugin file.