Can I have template parts with a straight HTML/CSS website? - html

I am trying to figure out if it is even possible to somehow implement 'template sections' with a straight html/css website. I use template parts all the time when building wordpress themes, but not sure if there is a way to implement a template section w/out php.
Can anyone offer some advice on this? Is this even possible?
Thanks in advance.

You can technically have "template" parts by copying and pasting the code from one page to another. So I guess that isn't what you would want to do.
So you are correct, in that you would need something like PHP for this. To set up some basic PHP is not that hard. It really will save a lot of needless code and time, by at least using PHP for your header and footer, if they will be the same on all pages.

Related

Adding custom HTML/CSS to a client's existing store in Shopify

Hi I'm totally new to Shopify and I'm having trouble grasping some basic stuff. So I have a client with an existing store and I was asked to design a landing page. I did all the html and css in vscode before I really took a look at Shopify and I want to know what the best way to create the page using the code I've already written would be. So far it looks like I have to create a custom template and then manually edit the JSON file but I have no idea how to work with JSON / how to link custom styles to that file. Can I create a template using Liquid and then refer ONLY that template to a custom styles sheet? I don't want to update the stores theme file before I know that this is all going to work / I'm wary of any kind of accidental overlap of tags and classes.
any help would be appreciated
Nothing to worry about. You can create sections with a preset block that can be added to the customizer. Learn the basics of schema and a little bit of liquid. Study the existing themes in free theme dawn. You will be able to figure it out. There is plenty of youtube channel to learn the basics also Shopify document has strong details. You can refer to it. Hope this helps https://www.youtube.com/channel/UCBukJ6yWzTdlLKY9QKhv-Mg You can try his skillshare class to understand the basics.
https://www.youtube.com/channel/UCUa4yMJ3mVquTL5TIpxatqQ This guy also explain it quiet easily. Even I like coding with Jan. He is too good

Create a dynamic Products page with just html/css?

Hi basically i want to have one html page that is the "products" page, and then just have the site navigation link correspond to a certain brand. I want it to look and function like any normal shopping site say a clothes site where you choose filters and it will show only clothes for that colour or brand and remove everything else, after a quick google it seems stuff like this is done in jquery and javascript etc. is it possible to do in just html/css?
I know C++ but it doesn't seem like its really suited for web dev.
I was also thinking maybe i could do this with a google custom search engine.
Just tell me straight if im out of luck and will just have to spend time learning some language/framework. Thanks.
No isn't possible without jquery or javascript
Well, i did it myself, so the answer would be: "yes it is possible".
However, extremely hard.
You can create the .html page using file creation and file writing.
and you can write to that file (just like any other text file) with fwrite or something like that (c++ function).
you can do it "dynamic", but all calculation would be on the c++ side with tons of if statements, but at the end? => you'll write the format of an html page:
<html><header><body>...
something like this:
fwrite("<html>\n",$fp);
fwrite("<head>\n",$fp);
....
once again... possible, but hard.

How can I add a table in a theme using Wordpress

I’m building a site as part of my research using Word Press. I’m trying to display samples on the homepage in a neat way, something similar to this one http://www.maitrechoux.com/menu/index.html?categ_id=all .
I have removed all of the home function using remove_action. How can I add the table and then how can I add the pictures inside each cell? Is it only matter of CSS or do I need to add HTML code for this? I recently joined word press community and this is the only thing remained to complete my website. Really appreciate any help!
NO, don't use tables. I think what you actually want is just to display something that looks like table.
You need to code both html and css for that.
You can use any of popular css frameworks to help you out, or you can code it yourself using, flex, floats, or grid...
When you are done then with wp functions you need to render that data in your wp theme.
Your question is to broad and big to be answered via code snippets or examples, sorry.
I recently wanted to change the template of my WordPress website and use React tables.
But this would cause my site to drop in Google rankings, and in terms of SEO, this would not be a good thing.
That's why I decided to use my template pre-built tables and change the files to my liking in the settings section by editing css files.

HTML to WordPress

I've never used WordPress.org before. I'm wondering if I can convert this html website that I have to wordpress exactly the same?
https://reporting.pacificamerican.org/pas/
And if this website is a wordpress site, does it means that I don't have to go into the codes if I want to update my content? Because right now with html site it takes more time to update all the contents.
Thank you.
Yes, you can, but looking at the content I wouldn't say it looks like a great idea. Mostly because of how static the current content seems to be.
Pros:
It looks like you are about to add a blog-page. WordPress does make such re-occuring content easy.
It looks like you have repeated the menu on every page. (If you change the menu on one page, then you have to makes changes to all pages as well?). WordPress would help with that and let you use one menu everywhere. But there are also tons of easier methods to accomplish the same thing without WordPress. (For example <?php include 'menu.php';?> using PHP).
Cons:
The "multiple sub-pages in one page" that you are using doesn't play naturally with WordPress. Absolutely possible yes, perhaps not even difficult, but not out-of-the-box for sure.
The time it would take to edit pages would likely not change as drastic as you hope. I believe that the current content looks so static that anyone with a bit HTML/CSS knowledge would rather want to edit those static html files over having to click around in the WordPress admin interface.
The scroll-spy, editing tables and things like the yearly admissions does not come naturally either. I can think of a few dozen ways to solve such things with WordPress, but if you are going to do this work yourself, then the WordPress-conversion will take some effort and the results will not always be as pretty as you might imagine.
You'll definitely take a performance hit over using only static html. (But that is true for any CMS/framework)
My suggestion would be to first look at your current workflow. Perhaps look at an IDE that can upload with a click or on save, have history so you can back up when things break, and predefined snippets that make static content changes easy, (and of course code syntax highlighting!).
What tools are you using now?
Also remember that you are asking on a coding-site. Not many here would opt to use the WordPress editor over simply editing html-files. In fact, I dare to say many here carries a deep grudge after having to work around some specific quirks in the WP editor (aka tinyMCE).
Sure, you could replicate the layouts.
Sure, your content would be editable with just a form.
It would take a lot of effort, but certainly doable.

How to repeat a menu without using iFrames or PHP in simple HTML/CSS or XML?

sorry for this ultimately newb question. I want to create a menu and not have to repeat the code of the menu on every single web page. I have done this with iframes in the past, but I know they aren't recommended. I have a pretty decent knowledge of HTML & CSS but I feel like I am missing something big here.
I am also not looking for the PHP solution which I believe is represented by:
<?php include("navigation.html"); ?>
Is there a good tutorial I can follow? I've heard this can be done with XML but I haven't been able to find what I am looking for exactly, and don't have any knowledge with it in the past.
In what I think is a related problem, I want to be able to place my google analytics code on just my index page and have it reference the entire website of pages, not just the index. Again, what am I missing here? Do I need to be using a content management system of some sort to pull off this slightly dynamic task? I don't think so...
Thanks for your help and please let me know if I can clarify my question any better!
Why don't you want to use PHP? It can be done with JavaScript (using AJAX), but you need to provide search engines with a way to crawl your site if you go that route.
Using includes in PHP to achieve this is simple and requires extremely little knowledge. Much easier and more efficient than doing it with JS. Also, I don't see how XML would be of any help here unless you read it in with JS (in which you'd have the same issue mentioned above.)
Use server side includes as mentioned already. They are support by pretty much all major webservers so php is not even required.
Check out the following articles:
http://en.wikipedia.org/wiki/Server_Side_Includes
http://httpd.apache.org/docs/1.3/howto/ssi.html (from apache, note no php needed)
http://www.boutell.com/newfaq/creating/include.html
Good Luck
I'm not really sure what options you have other than a .php include. I'm not sure of why you would be avoiding PHP unless the server didn't support it, as it's very simple to do an include (you really don't even need to know PHP to do this except for the include statement).
For your analytics code, you could put this in a .js file and just include it on every page:
<script type="text/javascript" src="analytics.js"></script>
Hope this was at least slightly helpful.
How about javascript? You could write a Javascript file that is included on each page that you wish to display the menu. The javascript could read an XML that contains your menu items and generates HTML to display the menu.
Parse and XML document with JS
http://www.w3schools.com/Xml/xml_parser.asp
jQuery menu solutions
http://speckyboy.com/2010/12/01/15-super-simple-jquery-menu-and-navigation-plugins/