All Kinds of Tech Stuff - Kokopelli's Kafe' is where I talk about tech gadgets, application programming, e-marketing, etc.
Showing posts with label custom PHP code. Show all posts
Showing posts with label custom PHP code. Show all posts
Sunday, April 2, 2017
WordPress Twenty Seventeen - Code Full-Width Page Layout
I have never started a WordPress site for a client based on one of the default themes. I just didn't like them as a starting point - that is until the Twenty Seventeen theme arrived.
I really like the full-width image on the home page and the placement of the site title and tag line. I also think the parallax effect on the home page is pretty neat. I even like the half-page layout. It's something different and something that works well with most content. But, there are times when you just want or need to use the full page for your content.
With very little code, you can create a full-page template for the Twenty Seventeen theme. It really only involves some very simple PHP and some CSS. I definitely recommend that you create a child theme for this code. It's the best way to make sure your customizations won't be overwritten when WordPress updates. If you are not sure about creating a child theme, it's very simple, follow the directions here or do a Google search. There are several good tutorials out there. (Don't want to create a child theme? See the notes in orange).
Step 1 (If you did not create a child theme, skip to Step 2).
After you create your child theme, create the following directory structure, replacing "your_child_theme" with the name of your theme:
wp-content/themes/your_child_theme/template-parts/page/
We will be cloning and customizing two files, one that will be placed in the directory you created above.
Step 2
We'll begin by cloning the page.php file.
(a) Open the file at wp-content/themes/twentyseventeen/page.php for editing. At the top of the file, just under the <?php code starter, add the following:
/**
Template Name: Full Width
**/
(b) Next find the following line of code (originally, it was on line 27 of the file, but you just added the lines above to the top of the file, so move down appropriately):
get_template_part( 'template-parts/page/content', 'page' );
and change it to:
get_template_part( 'template-parts/page/content', 'page-full-width' );
(c) Now, save this file with the name, page-full-width.php in your child theme directory:
wp-content/themes/your_child_theme/page-full-width.php
If you did not create the child theme, save this file (same file name) to the twentyseventeen theme directory:
wp-content/themes/twentyseventeen/page-full-width.php
Step 3
Now we are going to clone the default content file and customize it with some special CSS class names.
(a) Open this file for editing:
wp-content/themes/twentyseventeen/template-pages/page/content-page.php
(b) Now find the following line of code (around line 16):
<header class="entry-header">
And change it to:
<header class="entry-header-full-width">
(c) Next, find this code (around line 20):
<div class="entry-content">
Change this to:
<div class="entry-content-full-width">
In the next step, we will be writing some CSS that will use these new class names to alter the default layout of pages in the twentyseventeen theme.
(d) Before moving on, save the above with the name, content-page-full-width.php in the following directory:
wp-content/themes/your_child_theme/template-parts/page/content-page-full-width.php
If you did not create a child theme, save the file (with the same name) to:
wp-content/themes/twentyseventeen/template-parts/page/content-page-full-width.php
Step 4
In this step we will add the CSS rules to give us the desired full-page effect. Open the style.css file in your child theme directory.
I add the following lines to the end of the style.css file and make sure they stay at the bottom. This helps to insure that no other rules will take precedence over this code.
body:not(.has-sidebar):not(.page-one-column) .page-header,
body.has-sidebar.error404 #primary .page-header,
body.page-two-column:not(.archive) #primary .entry-header-full-width,
body.page-two-column.archive:not(.has-sidebar) #primary .page-header {
display: block;
width: 100%;
}
.blog:not(.has-sidebar) #primary article,
.archive:not(.page-one-column):not(.has-sidebar) #primary article,
.search:not(.has-sidebar) #primary article,
.error404:not(.has-sidebar) #primary .page-content,
.error404.has-sidebar #primary .page-content,
body.page-two-column:not(.archive) #primary .entry-content-full-width,
body.page-two-column #comments {
display: block;
width: 100%;
}
If you did not create your own child theme, I would recommend that you put the above code in the twentyseventeen default style.css file near similar code. The default style sheet is found at:
wp-content/themes/twentyseventeen/
For the first block of code above, add it at line 3756 - remember to put line breaks above and below it. And for the second block of code, add it at line 3775.
You can, of course, add any other custom styles you would like to the .entry-header-full-width and .entry-content-full-width classes.
That's it! Now when you are creating a page, you can choose the "Full Width" template in the Page Attributes section (see image). I hope you find this code helpful.
Note: you can find plugins that will do this for you. But, why bloat your site with all the code associated with a plugin, when you can add the simple code here? I obviously wouldn't. 😎😎
Wednesday, February 15, 2017
Chat App Demo
Here's a little demo that I recently complete that shows how a business could implement a chat app on their website.
The Chat App uses sessions to keep track of the visitors using the app - for the demo, there is a Representative and a Guest.
The web application can be customized for use on your website. It would allow clients and potential clients to contact you for help and information. If you have an employee at the computer or answering the phones, they could also monitor the app for active users.
For a production version, you could keep track of client information, guest names and/or email addresses, etc. And the complete conversation is saved to a database for future reference. The app can also be set up to allow the guest/client/visitor to have a transcript of the conversation send to their email.
To try the demo, visit our site at: http://demos.freelanceitsolutions.com/myChat/
You will find information and directions on this page as well.
If you have any questions on how this app could be set up and customized for your site, please contact us. You can also comment below. We will not publish comments that include personal or business contact information.
Wednesday, January 20, 2016
Editable Tables
This week's post is about adding functionality to your website or web application. Specifically, we are going to take a quick look at editable tables.
Tables are very useful when it comes to looking at information in an organized way. They have an obvious layout which makes them easy to use - usually. But, often with tables on websites, you get just a table. You can not reorganize the table to better view the information you want. And if information needs to be changed... forget it.
Well, not so fast! With modern browsers, some JavaScript, and some PHP on the back-end, you CAN have sortable, re-organizable, editable tables right on your website - think "spreadsheet." Yes, with the right developer creating the right code, you can even have the tables update and recalculate numbers.
The animation here shows a simple table of clients (made up). The company name for one of the clients is being updated.
This is just a simple example for this blog post. As mentioned above, the functionality of an editable table can be like a spreadsheet application. Your website can be more than just a place to display information. It can be an interactive, truly useful application.
If you have an idea for making your website more interactive and useful (for you and/or your visitors), please feel free to contact us at questions@freelanceitsolutions.com. You can also visit the Freelance I.T. Solutions website at http://www.freelanceitsolutions.com. :)
Tables are very useful when it comes to looking at information in an organized way. They have an obvious layout which makes them easy to use - usually. But, often with tables on websites, you get just a table. You can not reorganize the table to better view the information you want. And if information needs to be changed... forget it.
Well, not so fast! With modern browsers, some JavaScript, and some PHP on the back-end, you CAN have sortable, re-organizable, editable tables right on your website - think "spreadsheet." Yes, with the right developer creating the right code, you can even have the tables update and recalculate numbers.
The animation here shows a simple table of clients (made up). The company name for one of the clients is being updated.
This is just a simple example for this blog post. As mentioned above, the functionality of an editable table can be like a spreadsheet application. Your website can be more than just a place to display information. It can be an interactive, truly useful application.
If you have an idea for making your website more interactive and useful (for you and/or your visitors), please feel free to contact us at questions@freelanceitsolutions.com. You can also visit the Freelance I.T. Solutions website at http://www.freelanceitsolutions.com. :)
Monday, December 15, 2014
Screenshots - UCLArts and Healing
This is a site we are currently working on with Kraupp, Inc. It is a heavily modified WordPress site based on the Brio theme by QueryLoop.
Above is a shot of the 'home' page for the site. We began by creating a child theme for the client, as a proof-of-concept and then continued modifications - including modifications to plugins such as WooCommerce and UberMenu. We also created plugins and templates from scratch to meet the needs of the client.
This is the original Brio theme by QueryLoop (home page). Compare this to the last image and you can see just how much the child theme we created has been customized.
Outside designers created the designs and layout for the site. They provided us with images and PSD files which we used to create site graphics and customize code to get the desired 'final' product. *This site is still in progress... this might not be the final product!
Above is a shot of the 'home' page for the site. We began by creating a child theme for the client, as a proof-of-concept and then continued modifications - including modifications to plugins such as WooCommerce and UberMenu. We also created plugins and templates from scratch to meet the needs of the client.
This is the original Brio theme by QueryLoop (home page). Compare this to the last image and you can see just how much the child theme we created has been customized.
Outside designers created the designs and layout for the site. They provided us with images and PSD files which we used to create site graphics and customize code to get the desired 'final' product. *This site is still in progress... this might not be the final product!
The client required that each section use a different header. This posed a challenge since all of the pages for the original theme are based on just two PHP files. But, we were able to manipulate and add to the code and provide the client with what they wanted. (Also see next image).
The UberMenu plugin was used for the main navigation menu at the top of each page. Text, background and rollover colors where all customized beyond the original capabilities of the plugin.
Drop down menu colors also match the color of their section's header.
The store, cart and checkout pages are very customized versions of WooCommerce for WordPress. We were able to customize the code so that these pages match the rest of the site.
For this site we created custom templates, a plugin, and widgets - including a widget to add a custom sidebar and a widget to calculate shipping charges based on the client's requirements.
If you are an end business, an ad agency or a design company that needs code work to customize your WordPress site, please visit our website and feel free to contact us with any questions or for an estimate for your project.
Website: http://www.freelanceitsolutions.com
Subscribe to:
Posts (Atom)











