This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { createContext, useContext, useState, useEffect } from 'react'; | |
import { toast } from 'react-hot-toast'; | |
const Context = createContext(); | |
export const StateContext = ({ children }) => { | |
const getLocalStorage = (name) => { | |
if (typeof window !== 'undefined') { | |
const storage = localStorage.getItem(name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the post categories preserving the hierarchical order | |
* | |
* This function returns an array with the following structure | |
* | |
* [ | |
* [parent_term_id] => [ | |
* [children] => [ | |
* [child_term_id] => [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); | |
return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), array( 'status' => 404 ) ); | |
return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); | |
return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); | |
return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http | |
return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Simple Ajax Login Form | |
//Source: http://natko.com/wordpress-ajax-login-without-a-plugin-the-right-way/ | |
//html | |
<form id="login" action="login" method="post"> | |
<h1>Site Login</h1> | |
<p class="status"></p> | |
<label for="username">Username</label> | |
<input id="username" type="text" name="username"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cloudways force HTTPS with WWW | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^example.com [NC] | |
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301,NC] | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$catTerms = get_terms('product_cat', array( | |
'hide_empty' => 0, | |
'orderby' => 'ASC', | |
'child_of'=>'30' // air sampling applications | |
)); | |
echo '<ul>'; | |
foreach($catTerms as $catTerm) { | |
echo '<li> | |
<a href="'. get_term_link($catTerm) .'" >' . $catTerm->name.'</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- phpMyAdmin SQL Dump | |
-- version 4.8.5 | |
-- https://www.phpmyadmin.net/ | |
-- | |
-- Host: localhost:8889 | |
-- Generation Time: Jun 07, 2019 at 07:58 AM | |
-- Server version: 5.7.25 | |
-- PHP Version: 7.3.1 | |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-------------------Default Styles------------------------*/ | |
.oxy-woo-checkout { | |
width: 100%; | |
} | |
td.download-file a.button.alt { | |
width: 100%; | |
} | |
.woocommerce ul.order_details { | |
background: #f7f6f7; | |
padding: 20px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step 1: Add Data in a Custom Session, on ‘Add to Cart’ Button Click | |
<?php | |
add_action('wp_ajax_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback'); | |
add_action('wp_ajax_nopriv_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback'); | |
function wdm_add_user_custom_data_options_callback() | |
{ | |
//Custom data - Sent Via AJAX post method | |
$product_id = $_POST['id']; //This is product ID | |
$user_custom_data_values = $_POST['user_data']; //This is User custom value sent via AJAX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.upload-thumb { | |
display: inline-block; | |
width: 120px; | |
height: 120px; | |
overflow: hidden; | |
background: #e2e2e2; | |
border: 1px solid #cdcdcd; | |
line-height: 120px; | |
margin-bottom: 10px; | |
} |
NewerOlder