Adding an HTML template to WordPress - wordpress

Is it possible to add an HTML template to WordPress, without PHP? A client sent me a template with only HTML, JavaScript and CSS to migrate it to his WordPress account, but as far as I know it is not possible

Is it possible to add an html template to wordpress, without php?
Technically, yes. The WordPress Codex page for Theme Development§Basic Templates mentions:
At the very minimum, a WordPress Theme consists of two files:
style.css
index.php
Technically speaking, you could re-name your index.html template file to index.php and include a style.css file that's conformant to the WordPress spec to include the requisite theme metadata in the stylesheet header. That in itself would be installable into WordPress and usable as a Theme.
However your implication that this wouldn't be particularly helpful is also correct, because none of the dynamic content that WordPress would be used for would be pulled through and displayed out of the box – the template itself isn't written to leverage the proper PHP methods to pull this data in the first place. Your client is likely undereducated, misinformed, or otherwise confused on the wide gulf of fundamental difference between a standard website template and one that will work well with (or is specifically created for use with) WordPress.
Your client's implied expectation may be for you to update it into something that would be useful to use in a WordPress environment (which is most certainly possible, albeit likely arduous and time-intensive depending on the specific requirements), but interpreting communications between you and your client is much outside the scope of Stack Overflow.

Related

How to remove unused css in wordpress?

My page speed insights shows me to remove unused css what should I do?
Is there any plugin for wordpress to do so?
I am using worpress
the longer answer:
unused CSS is a curse in environments such as WordPress (or Joomla or Drupal or …) as each theme/ plugin adds CSS which covers all of the use cases where the plugin (or theme) can be used in. this means that each individual CSS-file on your site has a lot of code in it that isn’t strictly needed on a random page of your site (or may even not be needed on your site at all).
there currently is no way to automate the removal of unneeded CSS, but you might be able to get some improvement using e.g. “plugin organizer” to only allow plugins to work on specific pages) and by creating a child theme that only has the CSS needed for your site (you’ll have to dequeue the parent theme CSS though).
ALso you can use css and js minify wordpress plugin that can also help you to run your site fast.e.g
Fast Velocity Minify
WP Super Minify

Django CMS, per page CSS Styles

I often use small, page specific CSS files for a page in Typo3 using css_select. These styles usually apply only to some special element on these pages. Putting these styles in a global file doesn't feel right.
Using css_select I can select a bunch of files that may be included into the page's header, so that it loads it's special styles.
Now I'm looking for a way to do something similar in Django CMS 3. The only built in solution I'd know is to create a new template which seems a bit excessive for a single page where an image needs to be handled a bit differently from all the others, to name just one example.
Is there a way to do this using nothing but django CMS?
If not, is there an app that would do that?
If not, how could an app extend the page admin form in such a way that this function could be added.
You could extend the page.
See http://django-cms.readthedocs.org/en/latest/extending_cms/extending_page_title.html
A good example is https://github.com/nephila/djangocms-page-meta
This the above package allows you to add additional meta tags to page header.

Wordpress styles from customiser into stylesheet

So I'm creating a WP theme and I have started building customisation for it, currently I have the styles go to the header and they are inline. Is there any way I can put them into a stylesheet after the options(get theme mod) have retrieved the information? Hope that makes sense. Or is it okay to have all the styles being inline in the header? It just seems really messy...
Thank you
Basic answer is : No, can not.
Because, the stylesheet is a css file, your get_theme_mod() or get_option() functions are wp core functions working in php script. Data is fetched through those functions and printed in header through wp_head(), the whole process is on the php files only.
So, no wp core function can print it inside stylesheet.
Also, I have never seen any theme or plugin doing so. But if you are very interested a custom built function can be written using 3 php functions: fopen() fwrite() fclose()
That function will write desired string inside the stylesheet, but have to be parsed in functions.php or atleast before <head></head>
I think it is an fairly unique idea (some do this in custom template editors), subjected to views of other people.

Migrating an XDV theme product to Diazo

I am attempting to migrate from XDV to Diazo.
Currently I have a theme product that contains:
a custom navigation.py and layout.py
folders for:
overrides (for core overrides)
profiles (eg cssregistry.xml)
static (the theme resources, rules.xml, js, css and other cruft we may want to be able to call generically from the static directory with /++resource++theme/ syntax)
unit tests in tests.py.
My question is: does all of this come across to the Diazo theme or will i still need the current theme product installed for some parts of it?
I think so, yes.
overrides/ and profiles/ are the same.
The registration in configure.zcml for the rules URL should change to a one, and this will change the URL (++theme++ instead of ++resource++) but it's very similar.
There are some syntax changes, but they are minor and detailed here: http://pypi.python.org/pypi/plone.app.theming
Martin

Advice on SAFELY modifying / customizing Header on a Wordpress theme

I just started using Wordpress 3.0 to get a simple blog up and going. For now I am working with the default theme "Twenty Ten".
I want to make a simple change:
I'd like to modify the layout of the bloginfo( 'name' ), bloginfo( 'description' ), and php header_image() that appears at the top of the blog.
So, under Appearance, Editor, I select Header.php and I can see how this is being rendered.
It appears I can just modify this to my liking and I am good to go. (Correct?)
If so, my question is: is it considered proper practice to modify the html in header.php?
It seems to me that this is a bit dangerous, for example when it comes time to upgrade that same theme. How do I know which php files I have applied customizations to? Say I modify 6 php files, then an upgrade of the theme comes along...how does one handle re-applying these changes to the upgraded theme?
Is it a total "do over"?
Is there a better way to handle this scenario?
Maybe some themes are more powerful than others and can handle this type of customization more flexibly, and I should be searching for such a theme? Or, is there a reasonably proper and safe way to do this by directly editing the php files?
Child theme, child theme, child theme. Create a new folder in themes (name it whatever you want. Go crazy. As long as you don't name it twentyten). Create a style.css file in that directory and copy the whole style.css file from twentyten into it. Then, change the theme name in the css headers and add this line after the tags:
Template: twentyten
Then copy the header.php file over to another file in your directory, and edit to your heart's content. If twentyten ever gets updated, you'll get the benefit of those updates (unless they're in css or the header) without losing your changes.
Yes, you can edit the theme to your liking. I think it's common practice (however, I've always just created my own themes from scratch). Just give credit where it's due and don't pass it off as your own original work.
To avoid over-writing your customized theme when an upgrade comes out, you could save the customized one to a different folder in the themes directory with a different name, like Twenty Ten Customized. You can then copy or re-do the changes in the upgraded theme if you think the upgrades are worth the trouble. There's no rule that says you have to have the latest version of the theme, after all.
There might be other themes that allow a high degree of customization without editing the php, but most of the time you'd have to edit the php I'd think. (but I'm no pro theme developer.)
I would do as Benny suggested and rename the theme so that it isn't overwritten when you upgrade Wordpress.
I would not worry about updates to the actual theme because I don't think those ever really happen. The last Wordpress default theme was Kubrick and, to my knowledge, it rarely was updated and most updates were minor and went unnoticed by most users. If you go about customizing your theme, I don't think Wordpress is going to update the Twenty Ten theme to the point where you would ever wish that you hadn't edited the source because you wanted to upgrade to the new default theme.
If you don't want to actually edit any of the theme files, check out something like Thesis that allows you to customize most things from the admin.
Note: I'm not aware of a free theme that offers a lot of customization options through the admin panel, but there might be something if you check around for a while.
If I really had to stop automatic updates on my Wordpress theme, I'd do exactly what Kris + Chris Schmitz suggested (i.e. rename the theme differently). Modify header information in the style.css file in your theme's root to do this.
Personally, however, if the theme already works for me out of the box, I think I'd most probably already be fine with that. My website's running, the theme's working, and updating my theme may just break my site in ways I don't know.
I'd probably update it only for major security updates, but I'd probably be reading a changelog for that. But if I was doing that, I'd know what files exactly were modified, and I can just manually do it myself. Sounds like a lot of work, but better than my site buckling on me by some unknown cause.
If you do as Benny suggests and create a renamed copy of the default theme, you can use a free diff tool to compare the directories when an upgrade comes out. I'd use Meld ( http://meld.sourceforge.net/ ) to do a three-way directory comparison (Original theme, upgraded theme, modified copy) to determine if any changes have been made that impact the parts you changed, as well as to merge the upgrade changes into your modified files.

Resources