Transfer the code of a custom plugin into a theme - wordpress

I am working on a new project on WordPress.
I am developing a new website for a client based on their actual site (developed by an other team).
So, I decided to create a new WordPress theme and to use the existing content (client's request).
However, this supposes to reuse the custom plugins, in order to not re upload the pictures and the articles by hand.
I would like to include the custom plugins into the new theme. However, the plugins folder is outside the theme folder. So I was wondering if you have an idea on how I could transfer the code of a custom plugin into the new theme.
Thank you in advance.

What custom plugins are being used to handle pictures and articles? Uploaded files should go to /wp-content/uploads and all data is stored in the database. Removing the plugins might make the data inaccessible, but it shouldn't disappear.
Why are you moving functions from plugins to a theme? Or are these plugins inside of the /wp-content/themes/ folder? The way you handle the two cases is very different.
If you need to copy certain functions into a theme, you can move them into a functions.php file (or a functions.php file that calls to other files in that directory) in a child theme. The WordPress Codex has much better documentation on child themes than I could ever outline here. Placing the functions into your main theme is a permanent change and is not recommended when you're dealing with functions that are better-suited to plugins.
If you're copying plugins from one theme into another, you might want to look at plugin dependencies using TGM Plugin Activation.

Related

how to view and edit a wordpress php file locally (MAMP)

I am helping out creating a few wordpress templates. I've been sent over the basic content (wp-admin/wp-content/wp-includes folders and other wp-* files).
They've already created a new theme, and one front-page.php file. This file includes "parts" such as get_header and get_footer.
Essentially now they'd like me to create new templates using this theme, and php variables to make updating easier. My question is - how can I view this so I can see what i'm making?
I downloaded MAMP and set up a local server, and if I create a sample .php file in the htdocs folder, that page appears correctly. However when I paste the Wordpress folder that I was sent, nothing loads. Is there a special way to get a front-page.php including partials to load within a theme? Am I missing something obvious here?
You will have to Install WordPress completely in order to make it work. Then you will be able to add your folder in the "Themes" folder of WordPress..
You can Google "How to Install WordPress on Mamp" for more info... you will find plenty of websites helping you.
I also suggest you read a few blog post on how to create WordPress Themes... :)
Good luck

Turning my current website configuration into a wordpress theme

My searches for this keep turning up "How to make a wp theme from scratch" which is not what I want. I made a website using the theme Scrawl, but I made a bunch of modifications. I would like to turn this into a theme so I can use it to make other sites without having to do much of the work again. Is it possible?
The theme is simply the skin of the website. The configuration of the site, in broad sense of the word, is stored in the database and config files. If you want to transfer that, you can export the configuration settings from one site and import it in the other.
If you've only made modifications within the theme folder, you can simply .zip that folder and import the theme somewhere else.

Wordpress - Migrate Theme In New Wordpress

I wondering how to migrate custom theme from another wordpress to another without copying the whole wordpress...
I already tried copy the folder theme to new wordpress, but it has a lot of problem, because in the new wordpress, there is no Page as in origin wordpress.
Create some pages and see if it works.
Some themes uses plugins also, you must copy them too.
By the way, there's a dedicated stackexchange site for wordpress : https://wordpress.stackexchange.com/
You can never expect the 100% same experience on another install since there may not be the same plugins, pages, images, server settings and so on and so on. You can not even be sure your theme work on the new wordpress if the WP version is diffrent from the one you made the theme on.

I made a bunch of wordpress sites for clients and built off of the core theme (I didn't use a child them). What are my options now?

I didn't know about the best practice of not skinning/modifying/working off of the core wordpress theme (twenty-ten, twenty-eleven, twenty-twelve, twenty-thirteen), and a bunch of my clients sites are running right now on the core themes with a custom/modified skin.
I've heard stories of wordpress getting hacked and sites being compromised because wordpress is out of date. The wordpress team also pretty much states that security issues are being fixed with each update. I need to update the core wordpress files on these sites to prevent this, but now I'm scared that if I update wordpress, the theme will be overwritten.
In fact, I had a client click the update button once in the wordpress admin (not really knowing what they were doing) and overwrite the theme (that was pretty disasterous). I even use a plugin now to disable that message so my other clients don't do that.
What steps should I take now to fix this? Copy the theme, rename the folder/theme name in style.css, and change the theme in admin settings? Would I be OK to update wordpress after I do this? Or are there more steps that I need to take?
You have the right idea. Copy the theme folder and rename the new copy to something else like customtheme. Then edit customtheme's theme info in the comments at the top of style.css and switch to it in the admin panel. After that you are safe to update.
Do keep in mind that it's possible WP updates will break things anyway, depending on how you implement custom functionality and what plugins you are using.
Agree with the above. Don't go anywher near the WP core or the default themes. Either create child themes or better off, build your own.
Copying and renaming and existing theme will cause you all sorts of problems as each theme uses named functions. If you just rename the stylesheet there will be more conflicts than you can fix in a week of debugging.
If you are blocking the update messages you are putting your clients at risk.

is it possible for wordpress theme to work without wordpress?

I have bought this Wordpress theme:
http://themeforest.net/item/wp-pro-real-estate-3-responsive-wordpress-theme/1763306?ref=contempoinc
but I was stupid enough to forget that Wordpress will need to be installed in order to customize and work on it. Is it possible to run it on some server without Wordpress being include, to consider it as "done" template?
No, not in any practical way. Themes operate inside WordPress the way FireFox addons work inside Firefox or the way an Android App needs Android (to a lesser extent).
You must have WordPress to use a WordPress theme. There are too many class and function dependencies to run the theme without WordPress. It would be near impossible to even a load a theme and get all the templates to work without the WordPress core managing things.
You are better off starting from scratch than you are trying to edit the "WordPress" out of a WordPress theme.

Resources