I had researched about adding WordPress plugin in WordPress docker image, as in research I found the custom plugins can be added in docker-entrypoint.sh file. But I am not able to add custom plugins in entrypoint file. If is there any solution for this problem.
The docker-library/wordpress image does include a wordpress/docker-entrypoint.sh script.
However, the README points out:
This image does not provide any additional PHP extensions or other libraries, even if they are required by popular plugins.
There are an infinite number of possible plugins, and they potentially require any extension PHP supports. Including every PHP extension that exists would dramatically increase the image size.
So when you say "I am not able to add custom plugins in entrypoint file", it really depends on what error you have.
If you need additional PHP extensions, you'll need to create your own image FROM this one. The documentation of the php image explains how to compile additional extensions.
Additionally, the wordpress Dockerfile has an example of doing this.
Related
For the past 6 or so months I have been working on Laravel projects that are closer to web apps rather than full, content managed sites.
Recently I've started a Wordpress project and there's something that baffles me, how do you use Git with WordPress?
I ask because in Laravel you can basically push everything asides from node_modules, storage and the composer vendor folder.
I have also read that it is not a good idea to store wp-config in your repository, it's a strange one as Laravel uses an .env file to similar effect.
I found the following .gitignore
*.log
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/mu-plugins/
wp-content/wp-cache-config.php
wp-content/plugins/hello.php
/.htaccess
/license.txt
/readme.html
/sitemap.xml
/sitemap.xml.gz
You can ignore almost everything with the following exceptions:
wp-content/themes/my-theme (your theme and/or child theme)
wp-content/plugins/my-custom-plugin. (any custom plugins you create)
Additionally, I have found two very good sources for gitignore files for WordPress. The first which is very straightforward is on gitignore.org and the second which is extremely surgical is by Sal Ferrarello and can be found here: https://salferrarello.com/wordpress-gitignore/
Just modify as required and of course, avoid the config.php. It has install specific info such as your database host & login which you may not want to expose to prying eyes.
Laravel's .env file contains sensitive data just as WP's wp-config.php so we don't usually push it into the repo.
As to how I use Git with WordPress:
I exclude the wp-config.php file, the developer cloning the repo doesn't need it anyways: they can fill in the credentials themselves when working on the project on their local development environment. Another good reason to leave this file out is you don't want to expose your site's details (host, database name, username, password, salts, etc) to the world.
I exclude the uploads folder. The reason is that while developing we usually add dummy images to our posts and pages, images that won't be used at all when the site is finally ready for production so there's no reason to "pollute" the repo with these.
One of the things I love about Laravel is that database changes can also be tracked thanks to migrations. WordPress, on the other hand, doesn't have anything like that so you'll have to find a plugin (or some other mean) to keep your local database in sync with the staging one.
Update:
Since you updated your question to ask which files should be specifically excluded from the Git repo, I think the ones you posted from that .gitignore file you found are good enough. I don't see the need to ignore the readme.txt file though but that won't do any harm either.
I have used Fantastico and Softaculous in the past to install WordPress, however they are limited in that they require me to step through the wizard manually, and they can't set the default theme or install plugins.
Is it possible to write a script that automates the process? Would this be possible in PHP?
Even if it's not possible with a script, I am at least hoping to find a way to set the default WordPress theme upon installation.
You can switch themes using the switch_theme function. As for automating, of course it's possible. Your script could grab the wordpress code base with curl, includes a wp_config.php file you've already filled out, read the database info from that file in order to create the database and grant permissions as appropriate, and then run the wp_install process itself.
You can create a custom script in Softaculous and have your themes or plugins pre installed.
Here is the guide :
http://www.softaculous.com/docs/Making_Custom_Package
Openshift's default app generator sets Wordpress creation of sites to be a non-scalable version of their gears. I'd like to know if there is a way to set a scalable instance and install wordpress on it.
thanks!
I am working on this today actually and got a scalable wordpress site up and running on OpenShift. (www.runcloudrun.com)
I disabled the symlinks in the action_hooks and manually added my theme and plugins to the php/wp-content/themes and plugins directory. I also used a S3 plugin to store all of my media files on amazon s3 so my images and media would scale once OpenShift adds addiontal gears.
I am writing a blog post on how to do all of this and it should be posted later this week.
Edit to add the blog post: http://www.runcloudrun.com/?p=22
--
gs
You can checkout this AppFog solution. And if you visit his Github you'd find an OpenShift wrapper as well. These two might give you all the sparks it needs to think out a scalable solution on Openshift.
Just use the git source URL and create a new app with PHP. Once the app is created, add MySQL to it.
Once you've created the app, the important next step is to check in your modules directly to the Git repo.
By default, we wanted folks to be able to download plugins directly from Wordpress, but when you scale, those files aren't copied over. Also, the filesystem for each gear in a scaled app isn't shared, so modules uploaded after you scale aren't magically copied to all gears. Given that limitation, we decided to mark the QuickStart not scalable, so as to prevent unfamiliar users from getting into trouble.
If you're familiar with Wordpress just check those modules in directly to your source, and everything will scale.
I'm using WordPress 3.5.1. On my web site, the image paths for my post thumbnails, instead of directly linking to the image (i.e. /wp-content/uploads/image.jpg) are linking to /wp-content/uploads/cache/image-slug/12314335235.jpg
Images 'inserted into posts' show up using their original URLs (i.e. /wp-content/uploads/image.jpg). The cache somehow only applies to post thumbnails.
I've searched for why this is happening, but haven't found any solutions. If it makes a difference, I used to have WP Super Cache installed, but it's been a few days since I've properly deactivated and deleted the plugin.
Why would this be happening, and how can I stop it (and pull the images directly)?
Thanks!
Enable/Disable Caching in wp-config.php.
Another caching mechanism you could take advantage of is the default WordPress object cache. You can enable or disable the native WordPress object cache using your wp-config.php file, like so.
define('WP_CACHE', true);
Simply add the above code directly above /* That's all, stop editing! Happy blogging. */ using any text editor (Notepad is fine) and save the file.
For me, it was malware that had installed itself onto my site, the docs and cache folder where simple a hideout to execute its malicious code (wordfence flagged all the files). I couldn't delete it through the wp-files plugin, so i did it through ssh using the command
cd /home/bitnami/apps/wordpress/htdocs
sudo rm -f -r docs
Hey guys I have a plugin and its displaying info on /courses.php (using theme)
How can I get it to display info on /courses/single_course.php
I figured I'd just have to make a /courses/ folder in theme and have single_course.php inside that. However this doesn't seem to work.
I've tried googling but I'm struggling to figure out the keywords to solve this problem! ^_^
OK edit cause nobody is understanding:
I have plugin working. This is a custom plugin
I want to know how to make the following work http://www.example.com/plugin/index.php http://www.example.com/plugin/index.php
Currently to make http://www.example.com/plugin work you just need to create plugin.php in the theme directory and give a callback to a function in the plugin.
Creating /wp-content/theme/themename/plugin/index.php did not work as anticipated.
WP uses specific directories for placing its themes and plugins tom maintain organization standards.
// Pointing to theme WP themes directory
$_SERVER['DOCUMENT_ROOT']."/wp_content/themes/"
// Pointing to theme WP plugins directory
$_SERVER['DOCUMENT_ROOT']."/wp_content/plugins/"
or you can use the built in functions in wordpress
// for themes in any php file after headers
get_template_directory_uri() . '/js/custom_script.js'
// for plugins in you main plugin class
plugins_url('/js/newscript.js', __FILE__);
I would recommend keeping plugins in plugins and themes in themes. What you may be looking for is creating some extra plugin features which will require you to include you extra php functions and classes when the plugin in question is loaded.
First create a folder in under your plugin directory and chmod it with proper web securities
cd /path/to/wordpress/install/wp-content/plugins/your-plugin/
mkdir php
chmod 755
Next either copy or create and edit the new single_courses.php file. I've listed a quick method below if you are creating the new file from scratch. Otherwise just cp it over. In both cases we need to insure proper web access right using chmod.
cd /path/to/wordpress/install/wp-content/plugins/your-plugin/
echo -n "/*Extra Plugin Functions*/" > single_courses.php
chmod 644 single_courses.php
Now we need to be sure to include the new file in our main plugin file
/* Main Plugin File :: ./wp-content/plugins/your-plugin/theplugin.php */
...
include_once $_SERVER['DOCUMENT_ROOT']."/wp_content/plugins/you-plugin/php/single_courses.php"
...
Thats the basic way to go about it. Use the same process for hooking theme php files as well. Always make sure when creating directories and files on your server that proper security is put into effect or you open up your web directory and or server to get hacked.
Hope it helps...
You have to give us more information on what plugin you are using and what you are trying to achieve. The solution may be as simple as pasting a Plugin provided shortcode into the post area of the desired page. Alternatively you may have to edit the plugin itself.