The Code Practice Webapp in GatsbyJs

Setup cron job on wordpress

Do you want to set a cron job in your WordPress? if yes then is this is the right blog, I will show you the complete process of how you can create the cron job without any plugin or server details in just 10 minutes.  Schedules a hook which will be triggered by WordPress at the specified time interval. The action will trigger when someone visits your WordPress site if the scheduled time has passed.

continue reading.

Gatsby With WordPress

Gatsby Introduction Gatsby is an open-source, modern website framework that builds a static site generator built with ReactJS and powered by GraphQL. Gatsby allows anyone to create fast-growing engaging websites and applications. You can get data from the REST API and show the pages or posts on the websites, API calls,

continue reading.

Gatsby Introduction

Gatsby is an open-source, modern website framework that builds a static site generator built with ReactJS and powered by GraphQL. Gatsby allows anyone to create fast-growing engaging websites and applications. You can get data from the REST API and show the pages or posts on the websites, API calls, and flat files through GraphQL.Gatsby Introduction

In WordPress, we create dynamic websites, which need a server to run its PHP and Mysql. With the gatsbyJs, it is possible to create a static version of WordPress by generating a list of HTML pages for all the content on your site. It fetches all your Wordpress content with GraphQL.

continue reading.

Ionic Tutorial

Full Ionic installation and Introduction with Node and NPM, This tutorial will guide you, how you can run ionic without any NPM and Node errors. All the steps and commands are given in the well structure.
Ionic is a hybrid HTML5 mobile app framework. It’s used for both mobile and web apps. In this article, we will cover how to install ionic on your system either its window system or Linux system.

continue reading.

Disable Saturday and Sundays in Datepicker

If you want to disable the weekend day from date picker you have following ways 1) For jQueryUI DatePicker, it has an option to disable weekends day which you can use to explicitly not allow Weekends to be selected : $(“.datepicker”).datepicker({ beforeShowDay: $.datepicker.noWeekends }); 2) Hide Saturday Sunday /* Hide saturday/sunday in the jQueryUI DatePicker */ th.ui-datepicker-week-end, td.ui-datepicker-week-end { display: none; }

continue reading.

Ionic with wordpress

Full Ionic installation and Introduction with Node and NPM, This tutorial will guide you, how you can create a WordPress project in ionic without any NPM and Node errors. All the steps and commands are given in a good structure with images.
With this tutorial, you can create your WordPress project in ionic along with deploy on the free hosting.

continue reading.

Get time duration between 2 dates in java script

In this article, we will show you how to get the time difference between to dates in jQuery. For this, you need 2 dates From date and To dates. We will create a common function,  you just need to add the from date and to date in it then it will show you the result in an array. You can use this function anywhere in your code. Get time duration between 2 dates in java script <html> <head> <title>Get time duration between 2 dates in javascript</title> </head> <body> <script> function timeDuration(from_times,to_times){ document.write(“”+from_times); document.write(“<br>”+to_times); var res = Math.abs(from_times – to_times) / 1000; // get total days var days = Math.floor(res / 86400); document.write(“<br>Difference (Days): “+days); // get total hours var hours = Math.floor(res / 3600) % 24; document.write(“<br>Difference (Hours): “+hours); // get total minutes var minutes = Math.floor(res / 60) % 60; document.write(“<br>Difference (Minutes): “+minutes); // get total seconds var seconds = res % 60; document.write(“<br>Difference (Seconds): “+seconds); } var from_times, to_times; from_times = new Date( “Jan 11, 2020 11:10:05” ); to_times = new Date( “Fab 29, 2020 08:15:10” ); timeDuration(from_times,to_times); </script> </body> </html>

continue reading.

Get time duration between 2 dates in php

In this article, we will show you how to get the time difference between to date in PHP. For this, you need 2 dates From date and To dates. We will create a common function,  you just need to add the from date and to date in it then it will show you the result in an array. You can use this function anywhere in your code. Get time duration between 2 dates in PHP <?php function timeDuration($from_times,$to_times){ $date1 = strtotime($from_times); $date2 = strtotime($to_times); // Function To Get Difference between two dates $diff = abs($date2 – $date1); // It will give the difference year // total seconds in a year (365*60*60*24) $years = floor($diff / (365*60*60*24)); // It will give the month, subtract it with years and // divide the resultant date into // total seconds in a month (30*60*60*24) $months = floor(($diff – $years * 365*60*60*24) / (30*60*60*24)); // To get the day, subtract it with years and // months and divide the resultant date into // total seconds in a days (60*60*24) $days = floor(($diff – $years * 365*60*60*24 – $months*30*60*60*24)/ (60*60*24)); // To get the hour, subtract it with years, // months & seconds and divide the

continue reading.

jQuery is not defined or $ is not defined

jQuery is not defined or $ is not defined as a full solution with all the conditions. This is the common issue that mostly the developer and designer face during the jquery code. With this article, you can have a full solution to resolve this issue.

continue reading.

Show Google sheet data to JSON

This topic is related to show the google sheet data on your website. This is only an Excel spreadsheet. You can use this sheet as a database of your website. So you don’t need any database if you are using the google sheet. As many none technical person is used the Excel sheet for the store and save their business

continue reading.

Object Oriented Concepts (Oops)

[vc_row][vc_column][vc_column_text]Object Oriented Programming Oops is an important part of any programming language. Its play a big role in the programming language like c, c++, java, PHP so on. Object-Oriented Programming Oops is a programming langauge which is based on objects not only procedures and functions Object Oriented Concepts Class : Class is consist of methods and properties. A class is defined by using the class keyword, with the name of the class and a pair of curly braces {}. All its methods and properties goes inside the braces: Below is a class. In this simple class. $model is a property and hornBell() is a method. They are all prefixed with a visibility keyword (public).     <?php Class Car { public $model = “123456”; public function hornBell() { echo “Ding Dang Dong”; } } ?> Objects : Objects are also known as instance. You need to define a class one time and then create maltiple objects that belong to it. Objects of a class is created using the new keyword. To instantiate an object of a class, use the keyword new as below: <?php $car = new Car(); ?> Objects : Objects are also known as instance. You need to define a class one

continue reading.

PWA with nuxt js

Turning your web app into a PWA using Nuxt is too easy and simple Install PWA npm package: yarn add @nuxtjs/pwa //or npm i @nuxtjs/pwa Edit your nuxt.config.js file and add PWA module: { modules: [ ‘@nuxtjs/pwa’, ], } Make sure static directory exists and optionally create static/icon.png. (Recommended to be square png and >= 512x512px) Create or add this to .gitignore file so that this will not uploaded on git sw.*

continue reading.

Responsive menu in nuxt js

For Adding the responsive menu in the website you need to add the below code in your header.vue file <!———–Navigation—————–> <div class=”tv-main-menu tv-sticky-header bg-light”> <div class=”navbar-default container”> <nav class=”navbar navbar-expand-md navbar-light”> <button class=”navbar-toggler” type=”button” data-toggle=”collapse” data-target=”#navbarSupportedContent” aria-controls=”navbarSupportedContent” aria-label=”Toggle navigation”> <span class=”ti-menu”></span> </button> <div class=”collapse navbar-collapse text-center” id=”navbarSupportedContent”> <ul class=”navbar-nav tv-reset-navbar”> <li class=”nav-item”> <a class=”nav-link” href=”home”>Home</a> </li> <li class=”nav-item”> <a class=”nav-link” href=”aboutus”>About Us</a> </li> <li class=”nav-item search-list”><a href=”/search” class=”tv-search-btn”><i class=”ti-search”></i></a></li> </ul> </div> </nav> </div> </div> <!———–End—————–>  

continue reading.

Infinite Scroll in Nuxt.js

For adding the Load More functionality in the nuxt js you need to install the Vue-infinite-loading here with npm npm install vue-infinite-loading -S Then you need to import this package in your post file like posts.vue file. Make sure you have installed the Axios import axios from ‘axios’ import InfiniteLoading from ‘vue-infinite-loading’ Now your setup is ready you need to add the code on the bottom of the posts.vue file <infinite-loading v-if=”posts.length” spinner=”spiral” @infinite=”infiniteScroll” ></infinite-loading> posts.length is the post array in which all the posts are store. Then copy and paste the below code on the method functionality infiniteScroll($state) { setTimeout(() => { this.page++ axios .get(this.url) .then((response) => { if (response.data.posts.length > 1) { response.data.posts.forEach((item) => this.posts.push(item)) $state.loaded() } else { $state.complete() } }) .catch((err) => { console.log(err) }) }, 1000) } setTimeout is for to call the code a little bit late. axios.get is getting the data from the api. response.data.posts.length is to check whether it’s getting data, if there is no data it will be false. response.data.posts.forEach((item) => this.posts.push(item)) is adding every new item from array to the posts $state.loaded(),$state.complete() is the animation of loading the component. Complete script code ><script> import axios from ‘axios’ import InfiniteLoading from

continue reading.

PHP Foreach Loop

Loops through a block of code for each element in an area. Syntax <?php foreach ($array as $value) { code to be executed; } ?> Example The following example will output the values of the given array ($colors): <?php $colors = array(“yellow”, “green”, “blue”, “golden”); foreach ($colors as $value) { echo “$value “; } ?>

continue reading.

PHP For Loop

PHP for loop can be used through a set of codes for the specified number of times. Syntax <?php for(initialization; condition; increment/decrement){ //code to be executed } ?> Example The example below return the numbers from 0 to 5: <?php for ($a = 0; $a

continue reading.

PHP Do While Loop

The block of code executed once and then the condition is evaluated. If the condition is true the statement is repeated as long as the specified condition is true. It executes the code at least one time always because the condition is checked after executing the code. Syntax <?php do { code to be executed; } while (condition is true); ?> Example This example sets the $x variable to 7, then it runs the loop, and then the condition is checked: <?php $x = 7; do { echo “The number is: $x”; $x++; } while ($x <= 5); ?>

continue reading.

PHP While Loop

Loops through a block of code as long as the condition specified equal to true. Syntax <?php while (when condition is true) { code to be executed; } //or while(condition): //code to be executed endwhile; ?> Examples The example below displays the numbers from 1 to 6: <?php $x=1; while($x

continue reading.

PHP Loops

4 Types of Loops in PHP PHP for loop can be used to repeat the set of code for the specified number of times. while() — Loops through a block of code as long as the condition specified equal to true. do()…while() — The block of code executed once and then the condition is evaluated. If the condition is true the statement is repeated as long as the specified condition is true. for() — PHP for loop can be used through a set of codes for the specified number of times. foreach() — Loops through a block of code for each element in an area

continue reading.

PHP Switch Statement

The switch statement is used to make a decision from the number of choices is called a switch-case-default. The switch statement is the same as a series of IF statements on the same expression. Syntax <?php switch (n) { case condition1: code to be executed if n=condition1; break; case condition2: code to be executed if n=condition2; break; case condition3: code to be executed if n=condition3; break; … default: code to be executed if n is different from all labels; } ?> Example: In the following example, $color is equal to green, therefore the switch statement executes the third echo statement. <?php $color = “green”; switch ($color) { case “yellow”: echo “color is yellow!”; break; case “blue”: echo “color is blue!”; break; case “green”: echo “color is green!”; break; default: echo “color is neither yellow, blue, nor green!”; } ?>

continue reading.

PHP If Else

The if, elseif …else and switch statements are used to take decisions based on the different conditions. In PHP we have the following conditional statements: if() statement – executes some code if one condition is true if()…else statement – executes some code if a condition is true and another code if that condition is false if()…elseif()…else statement – executes different codes for more than two conditions switch statement – selects one of many blocks of code to be executed

continue reading.

PHP Operators

PHP language has following types of operators. Arithmetic Operators Comparison Operators Logical/Relational Operators Assignment Operators Conditional/ternary Operators Arithmetic Operators Operator Description Example + Adds two operands A + B will give 30 – Subtracts second operand from the first A – B will give -10 * Multiply both operands A * B will give 200 / Divide numerator by de-numerator B / A will give 2 % Modulus Operator and the remainder of after an integer division B % A will give 0 ++ Increment operator, increases integer value by one A++ will give 11 — Decrement operator, decreases integer value by one A– will give 9 Comparison Operators Operator Description Example == Checks if the value of two operands are equal or not, if yes then condition becomes true. (A == B) is not true. != Checks if the value of two operands are equal or not, if values are not equal then the condition becomes true. (A != B) is true. > Checks if the value of the left operand is greater than the value of right operand, if yes then condition becomes true. (A > B) is not true. < Checks if the value of the left

continue reading.

PHP Data Types

PHP data types are used to hold different types of data or values. PHP supports 8 primitive data types that can be categorized further in 3 types: Scalar Types Compound Types Special Types PHP Data Types: Scalar Types There are 4 scalar data types in PHP. boolean integer float string PHP Data Types: Compound Types There are 2 compound data types in PHP. array object PHP Data Types: Special Types There are 2 special data types in PHP. resource NULL

continue reading.

PHP $ and $$ Variables

The $a is a variable with the $a  name that stores the value like string, int, float, etc. The $$aa is a reference variable that stores the value of the $variable inside it. Examples. <?php $a = “xyz”; $$b = 50; echo $a.” “; echo $$b.” “; echo $xyz; ?> In the above example, we have assigned a value to the variable a as xyz. The value of the reference variable $$b is assigned as 50. Now we have printed the values $a, $$b and $xyz.  

continue reading.

PHP &#8211; Constants Types

[vc_row][vc_column][vc_column_text]PHP constants are name or identifier that can’t be changed at the time of the execution of the script. we used PHP constants in 2 ways: Using define() function Using const keyword PHP constants follow the same PHP variable rules. For example, it can be started with a letter or underscore only. Conventionally, PHP constants should be defined in uppercase letters. PHP constant: define() Let’s see the syntax of define() function in PHP. define(name, value, case-insensitive)  name: specifies the constant name value: specifies the constant value case-insensitive: Default value is false. <?php define(“MESSAGE”,”Hello JavaTpoint PHP”); echo MESSAGE; ?> Output: Hello JavaTpoint PHP Const Keyword The const keyword defines constants at compile time. It is a language construct not a function. It is a bit faster than define(). It is always case sensitive. <?php const MESSAGE=”Hello const by JavaTpoint PHP”; echo MESSAGE; ?> Output: Hello const by JavaTpoint PHP [/vc_column_text][/vc_column][/vc_row]

continue reading.

PHP echo and print

[vc_row][vc_column][vc_column_text]In PHP have two way to get the output:- echo print Echo: In ‘echo’ statement is a language construct and never behaves like a function, hence no parenthesis required. The end of the echo statement the semi-colon (‘;’) is needed. We can use ‘echo’ to output strings or variables. Below are some of the usage of echo statement in PHP: Display Text The following example shows how to output text with the echo command (notice that the text can contain HTML markup): Example Live Demo <?php echo “<h2>PHP is Fun!</h2>”; echo “Hello world!<br>”; echo “I’m about to learn PHP!<br>”; echo “This “, “string “, “was “, “made “, “with multiple parameters.”; ?> Display Variables The following example shows how to output text and variables with the echo statement: Example Live Demo <?php $var1 = “Learn PHP”; $var2 = “W3Schools.com”; $x = 5; $y = 4; echo “<h2>” . $var1 . “</h2>”; echo “Study PHP at ” . $var2 . “<br>”; echo $x + $y; ?> The PHP print Statement The print statement can be used with or without parentheses: print or print(). Display Text The following example shows how to output text with the print command (notice that the text

continue reading.

PHP Variables

[vc_row][vc_column][vc_column_text] PHP Variables Variables are use to store the value Creating PHP Variables In PHP, a variable starts with the $ sign, followed by the name of the variable: Example Live Demo <?php $txt = “Hello world!”; $x = 5; $y = 10.5; ?> After the execution of the statements above, the variable $txt will hold the value Hello world!, the variable $x will hold the value 5, and the variable $y will hold the value 10.5. Note: When you assign a text value to a variable, put quotes around the value. Note: Unlike other programming languages, PHP has no command for declaring a variable. It is created the moment you first assign a value to it. [/vc_column_text][/vc_column][/vc_row]

continue reading.

PHP Comments

[vc_row][/vc_row][vc_column][/vc_column][vc_column_text] Comments in PHP Comment code in PHP is a line that is not executed in the program. Its only purpose is to be read by someone who is looking at the code. Comments can be used to: Let others understand your code Remind yourself of what you did – Most programmers have experienced coming back to their own work a year or two later and having to re-figure out what they did. Comments can remind you of what you were thinking when you wrote the code PHP supports several ways of commenting: Live Demo <?php // This is a single-line comment # This is also a single-line comment /*This is a multiple-lines comment block*/ ?> [/vc_column_text]

continue reading.

PHP Syntax

[vc_row][vc_column][vc_column_text] Basic PHP Syntax A PHP code starts with <?php and ends with ?>: <?php // PHP code write here ?> PHP files extension is “.php“. A PHP file contains HTML tags, and some PHP code.   [/vc_column_text][/vc_column][/vc_row]

continue reading.

PHP Installation

[vc_row][vc_column][vc_column_text] The PHP Installer Although an installer is available from php.net, I would recommend the manual installation if you already have a web server configured and running. Manual Installation Manual installation offers several benefits: backing up, reinstalling, or moving the web server can be achieved in seconds (see 8 Tips for Surviving PC Failure) and you have more control over PHP and Apache configuration. Step 1: Download the files Download the latest PHP 5 ZIP package from www.php.net/downloads.php As always, virus scan the file and check its MD5 checksum using a tool such as fsum. Step 2: Extract the files We will install the PHP files to C:\php, so create that folder and extract the contents of the ZIP file into it. PHP can be installed anywhere on your system, but you will need to change the paths referenced in the following steps. Step 3: Configure php.ini Copy C:\php\php.ini-development to C:\php\php.ini. There are several lines you will need to change in a text editor (use search to find the current setting). Where applicable, you will need to remove the leading semicolon to uncomment these setting. Define the extension directory: extension_dir = “C:/php/ext” Enable extensions. This will depend on the libraries you want to use, but the following extensions should

continue reading.

Nuxt JS Tutorial

[vc_row][vc_column][vc_column_text]In this nuxt js tutorial we well guide you the nuxtjs following things. 1) Nuxt js installation app basic setup 2) API integration 3) Slick slider 4) Load More post functionality 5) Bootstrap menu integration 6) PWA with nuxt js 7) Deploy on netlify (On free hosting) [/vc_column_text][vc_tta_accordion active_section=”1″][vc_tta_section title=”Nuxt JS installation” tab_id=”Nuxt-JS-installation”][vc_column_text]Make sure you have node install on your system you can check it with node -v cmd in CLI Please check the screenshot for the installation it will more clear to you, for select the option you need to use ENTER key and if there is multiple options then you need to choose it by using SPACE BAR key then enter. npx create-nuxt-app <project-name> Or if you are using NPM then you can do: npm init nuxt-app <project-name> Or with yarn you can do: yarn create nuxt-app <project-name> Features you can use arrow keys for choose the option and select with the space bar button. Choose the package manager Yarn Npm Choose your favorite UI framework: None (feel free to add one later) Ant Design Vue Bootstrap Buefy Bulma Element Framevuerk iView Tachyons Tailwind CSS Vuetify Choose between integrated server-side frameworks: None (Nuxt default server) Adonis Express Fastify Feathers

continue reading.

NuxtJS with PWA

NuxtJs with PWA is a good combination.
A progressive web application is the latest technology to combine the best of web and mobile apps. The website is built using web application but that acts and looks like an app.

continue reading.

Progressive Web Apps

What is Progressive Web Apps ?
A progressive web application is the latest technology to combine the best of web and mobile apps. Website is built using web application but that acts and looks like an app.

Progressive Web Apps are user experiences that have the reach of the web, and are:

continue reading.

What is NuxtJS?

Nuxt is a javascript framework designed to give you a strong architecture following official Vue guidelines. Incrementally adoptable, it can be used to create from static landing pages to complex enterprise ready web applications.
Nuxt js is a higher-level framework that builds based on Vue Js

continue reading.

What is PHP?

[vc_row][vc_column][vc_column_text]PHP is a server-side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites. Even a non-technical person can create sites using its CMS.WordPress,osCommerce are the famous CMS of PHP. The PHP functions were returned in the form of HTML code because before the page loaded the PHP code gets transformed into HTML. This process makes the PHP pages secure for accessing databases and other secure information. The PHP functions were returned in the form of HTML code because before the page loaded the PHP code gets transformed into HTML. This process makes the PHP pages secure for accessing databases and other secure information. A PHP file contains PHP tags and ends with the extension “.php” What is a PHP File? PHP files can contain text, HTML, CSS, JavaScript, and PHP code PHP code is executed on the server, and the result is returned to the browser as plain HTML PHP files have extension “.php” What Can PHP Do? PHP can generate dynamic page content PHP can create, open, read, write, delete, and close files on the server PHP can collect form data PHP can send and receive cookies PHP can add, delete, modify data in your database

continue reading.