Use Wordpress for static WebSite - wordpress

I want to create a static website and use wordpress only to "compose" the website. I want to create a template that only use the same header and footer and change the content of the page (home, contact ecc dcc). My site is not a blog or any other type of site that needs CMS I only want to use Wordpress to have only one header and footer and don' t want to change it in all pages when I need some customization to it. I hope I was clear enough! Thanks!

You can create a site in WordPress (or any other CMS) on your own local computer, then save a copy using an offline browser such as HTTrack. Then upload the HTTrack saved HTML to your webhost.
This will make your site faster, as there will be no need to execute PHP on page requests, and the webserver will use its default caching headers. (Also, you get the option of using a cheaper hosting without support for PHP and MySQL.)
Any time you change the site, you'll need to edit the live WordPress version, save it again, and reupload the files.

Disclaimer: I'm dev of the WP Static HTML Output project.
It's been around for a few years and still has 5k+ active installs, but jazzing it up with some more features now and its whole purpose is to allow you to use WordPress for your site development and export to a static HTML version for speed, security and portability.
For the OP, the basic FTP publishing option may be of use. For more advanced cases, there are services like Netlify which can auto build/deploy your static site from a Git branch.

In the Settings | Reading admin page, choose a static page for your front page display. Build your site out using Pages instead of Posts. Each Page will inherit your site's standard header and footer. Create your Main Menu from the Appearance | Menu admin page to hook together your Pages. Use widgets and standard HTML links as needed. Then dress up your site with one of the many available themes.

A bit late to the table on this one but it seems that Wordpress is totally overkill for a static site. Wordpress pages can be cached with cache plugins but when any Wordpress site loads there are a number of scripts and custom php functions that run each time a page loads.
Why not just build a flat file website and simply include your header and footer with PHP? Far quicker to set up and based on your question it seems that this is simply what you need.
Added to this, you won't have an admin area for your site or a database, just the files on the server - surely this makes your site less hackable too. An added bonus is a really easy site to version control with Git or SVN.

If there's someone else out there wanting to use a static site generator over Wordpress, here's a script called WP Static which does just this: http://mossiso.com/code/make-wordpress-static

Another great solution to this problem is to use a specific software that is created exactly to do that. For Mac, for example, there's a software called Hammer that "compile" your site every time you save and includes your header and footer to the page. Is really useful.

Related

Restarting a wordpress project

I am a freelance developer, and I normally build sites from scratch without using any code generating sites like WordPress or Square Space. But my current client insists on using WordPress. However, I am rescuing this project from a previous developer who made a big mess because from the looks of it does not seem like they knew what they were doing.
Is there a way for me to restart everything, on a clean slate and template on WordPress? I would like to have none of what the previous developer has done. Also is there a way for me do do direct coding using HTML, CSS, JavaScript etc on a WordPress site?
Yes, you just need to look into how to create a theme, since themes are the basis of the Wordpress structure. Ultimately, if you have the code for a website, it can be broken into separate files that Wordpress can use.
See: http://www.wpexplorer.com/create-wordpress-theme-html-1/
If the previous developer has done all the work in the theme files, then simply switching the theme to a default theme (Like Twenty Sixteen) will give you a nice clean slate to dig in and jump off with. You will want to create a child theme of any existing theme if you want to make any changes. If, however, the developer has messed with other files besides the theme folder, then you will most likely want to export the content only (as a logged-in administrator, go to Tools > Export (here's a screenshot))
Then on a new environment (I prefer testing these things first on a local virtual environment like VVV, and then transition to a development subdomain on the same server that the site will eventually go live on and securing it with an htaccess user/password to block curious eyes), import the content on a fresh installation of wordpress via the same menu (Tools > Import). This will give you a fresh installation with the content that's been created, but without any of the mess.
For more information about importing content - here's the codex article.
I hope that's a good start - but if I've glossed over anything you don't understand, let me know - I'm happy to help.

Is there a way to upload an external folder in WordPress

I have a set of custom html pages that are not made with WordPress in folder DIR
In the WordPress blog I have a web page called SPECIAL that only some users can access (after being authenticated). I would like to know if there is a way to allow those users to open the web pages in DIR (in a comfortable way)
For now i am using a very non-pratical solution:
I make a zip archive of that folder, upload it from the Admin interface of WordPress, using WP-Filebase, and put a link to the DIR.zip in the web page SPECIAL.
Yes I agree that my solution is ridiculous. Please help me find a better one.
Thanks in advance.
One solution would be to link to the pages contained within the DIR folder on the SPECIAL page itself, or create an additional WordPress-based page, linked to from SPECIAL, that performs the same function as your DIR/index.html page.
Alternatively you could place an iframe of DIR/index.html on your SPECIAL page.
A longer term solution would be to migrate the contents of DIR into your WordPress installation, and restricting access to the same group of users who can currently see the SPECIAL page.

Static html to wordpress migration

I have a static HTML site (about ten years old) which I am going to migrate to a Wordpress site.
I have used Wordpress before but never as a migration target. From some initial background reading I have come up with the following process to perform the migration:
Check hosting provider/package for Wordpress suitability
Generate complete current site map
Make a complete backup of current site
Install Wordpress in subdirectory
Install Maintenance mode plugin and activate
Migrate content to Wordpress instance (looks like this could be
painstaking..)
Install suitable theme
Customise selected theme with Logo/fonts/colours etc.
Deactivate maintenance mode
Make Wordpress site available from domain root
Delete old static html site files
(The migration may take place over several weeks/months so I need the static HTML site to be available until step 10 is completed)
In my naivety are there any pitfalls in the above process, or additional issues I have failed to consider?
Are there any other accepted 'best practices' when performing this kind of migration?
Here's a good tutorial:
http://code.tutsplus.com/tutorials/creating-a-wordpress-theme-from-static-html-creating-template-files--wp-33939
For developers who want the theme converted from HTML in easy way (but no guarantee if it can produce the output as expected):
http://www.htmltowordpressconverter.com/
Hope this was helpful!!!!
WordPress theme styles come in all shapes and sizes. Converting from a static HTML site to something database driven like WordPress can be as easy or complicated as you want.
If you just want to integrate WordPress into an existing HTML theme it's as easy as installing WP, setup the database and config, then building in the old HTML structure using WP. This way everything will be the same but managed within WordPress i.e. Pages, Menus, Sidebars.
Here's are some useful links:
https://codex.wordpress.org/Using_Themes
https://codex.wordpress.org/Theme_Development
https://codex.wordpress.org/Stepping_Into_Templates
And here's a "Start from Scratch" theme that would be simple to start from. Just install it, activate it, then begin migrating the main content i.e. copy and images etc, and building the theme itself.
http://adopttheweb.com/start-from-scratch.zip

Wordpress Multisite: Mobile theme on its own wordpress install reading / sync with main database

I don't want to use any plugin that redirect to mobile version (as theme is not activated and brings in lots of issues)
For now i made a new network site for the mobile theme, but when going to a post its going to the main site theme (and if i add plugin to forward main site to mobile version it kinda of works, but brings in many issues).
So best sulotion would be to have exact same replica of the main multisite wordpress on a subdomain, just with mobile theme activated for all sites in network..
problem how i can i do it?also to keep posts on mobile version in sync with the main site?
Many thanks!
and hope i was clear..
You probably don't want to run a WP Multisite - you can share users and the Wordpress install, but the posts, meta values, etc are in separate tables. If you want to run the site on a single content repository (your posts), same users, etc but just with a different theme at different domains, I would use multiple installs pointed to the same database with the mobile site pointing to a different domain by overriding the WP_HOME and WP_SITE_URL constants and a filter on get_option() (using 'option_' . $option where $option is template, stylesheet, and current_theme) to override the theme that is loaded - look at your database values with the mobile them selected to figure out what values you want to return. You have the issue of keeping the code updated between the two installs, which shouldn't be too hard to accomplish with version control (which is a good idea anyway), using a different repository for the file on the mobile site that overrides the option values, an #include perhaps.

Two domains on same WP site, but different header

I'm using Wordpress for a client's website and this client asked me if he could have two domains with the same content, but a different logo on top of the page. So for example:
www.website1.com with logo1
www.website2.com with logo2
Both with same theme & contents.
I was thinking of a double WP install, but then you have to do every change two times. I read something about multisites in Wordpress, but could not find out how to do this.
I hope someone can help me out, thanks!
On the SEO front this is a bad idea, you will duplicate all content Google won't know what to value more. But if you really want it.
you could do this with two wp install's but there are problems.
First set your site url's in the wp-config
Second let both installs connect to the same database. The change in
header can be detected with $_REQUEST (google it)
Now there are 2 problems left which I don't know how to fix.
The uploads folder need to be synchronized so each site can access the uploads
the solution will be with simlinks stuff. (which I'm not familiar with)
And your hosting provider has to allow it.
If you add an internal link in your post/pages it will prepend the complete site url, and save this hard coded in the database.
The solution of this could be in the editor, of to filter the content before it is printed.
If you want to go this way I'm willing to look further into these problems
Here is a relatively recent article on how to set a multisite wordpress network up.

Resources