Skip to main content

Posts

Showing posts with the label theme

Create Custom Template Page in Wordpress Theme

 Assalamualaikum...     Wanted to create a simple page that can quickly get a delivery quote for my customer~    Issue with Wordpress is most of the time need to fill up the address details before getting full quotation as im using a free plugin that is not so user friendly.    While I have manual quotation request incoming to our 4nutz social medias, i decided to spin up a tool page that help to quickly calculate the pricing.   ok today wanted to share first   How to create a page template in Wordpress theme?   Reason doing so is so that we do changes in the wordpress theme or the best is the child theme. not directly apply in database the code nor hacking the wordpress framework code! that is really hard and headache to maintain!   For those who dont know how to create Child Theme, please refer to this tutorial first!   Step one, create a php page file in Wordpress Theme/ Child Theme vim page-distance-calculator.php Step two,...

The right way to load Javascript and CSS files in Wordpress.

The way we load Javascript and CSS files in Wordpress is different from the normal HTML way. First of all, we need to identify where do we want to load the scripts. Is it in our theme or plugin?. Lets say we want to load it to  our theme, we can easily create a new folder in our child theme and place the scripts in it. for example Then we can load it in our child theme functions.php file. Ok when we load, we need to understand the parameters that we want to pass in... for wp_enqueue_styles is quite straight forward. but for wp_enqueue_script.. Pay attention on deps parameter. whether the script that we want to load has dependencies with other scripts / jquery. Same goes to in_footer parameter, do we want to load in header or before the body closing tag. If we do not define properly. Our scripts might not be loaded properly. Pay attention on those two parameters.