add_filter( 'get_custom_logo', 'change_logo_class' );
function change_logo_class( $html ) {
$html = str_replace( 'custom-logo-link', 'navbar-brand', $html );
$html = str_replace( 'custom-logo', 'img-fluid', $html );
return $html;
}
add_filter( 'get_custom_logo', 'change_logo_class' );
function change_logo_class( $html ) {
$html = str_replace( 'custom-logo-link', 'navbar-brand', $html );
$html = str_replace( 'custom-logo', 'img-fluid', $html );
return $html;
}
Add this function in the functions.php file.
function current_year() { $year = date('Y'); return $year; } add_shortcode('year', 'current_year');
add_action( 'woocommerce_add_to_cart', 'cwpai_woo_send_email_to_admin_on_add_to_cart', 10, 6 );
function cwpai_woo_send_email_to_admin_on_add_to_cart( $cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data ) {
$product = wc_get_product( $product_id );
$product_name = $product->get_name();
if ( isset( $_POST['add-to-cart']) ) {
$company_name = $_POST['membership_company_name'];
$contact_person = $_POST['membership_contact_person'];
$membership_address = $_POST['membership_address'];
$membership_city_town = $_POST['membership_city_town'];
$province = $_POST['province'];
$postal_code = $_POST['postal_code'];
$wcb = $_POST['wcb'];
$industry_code_s = $_POST['industry_code_s'];
$cor = $_POST['cor'];
$expiry_date = $_POST['expiry_date'];
$if_your = $_POST['if_your'];
}
$data = "<table style='width:50%' cellpadding='5'><tr>
<th>Item</th>
<th>Description</th>
</tr><tr>
<td>Name</td>
<td>$product_name</td>
</tr>
<tr>
<td>Company Name:</td>
<td>$company_name</td>
</tr>
<tr>
<td>Address</td>
<td>$membership_address</td>
</tr>
<tr>
<td>City/Town</td>
<td>$membership_city_town</td>
</tr>
<tr>
<td>Province</td>
<td>$province</td>
</tr>
<tr>
<td>Postal Code</td>
<td>$postal_code</td>
</tr>
<tr>
<td>WCB #</td>
<td>$wcb</td>
</tr>
<tr>
<td>Industry Code(s)</td>
<td>$industry_code_s</td>
</tr>
<tr>
<td>C.O.R #</td>
<td>$cor</td>
</tr>
<tr>
<td>Expiry Date</td>
<td>$expiry_date</td>
</tr>
<tr>
<td>If your company has ever registered with another Certifying Partner please name</td>
<td>$if_your</td>
</tr></table>";
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( 'example@gmail.com', 'New notification', $data, $headers );
}
Pro Membership
<?php function my_redirect_nonmembers() {
// Make sure PMPro is active.
if ( ! function_exists( 'pmpro_hasMembershipLevel' ) ) {
return;
}
// Ignore members. Change to check for specific levels.
if ( pmpro_hasMembershipLevel() ) {
return;
}
global $post;
if( ! is_admin() && ! empty( $post->ID ) ) {
if( $post->post_type == "page" || $post->post_type == "podcast-video" ) {
//check if the user has access to the parent
if( ! pmpro_has_membership_access( $post->ID ) ) {
wp_redirect( pmpro_url( "levels" ) );
exit;
}
}
}
// Update this array.
$not_allowed = array(
"/members/",
"/groups/",
"/groups/create/",
);
// Get the current URI.
$uri = $_SERVER['REQUEST_URI'];
// If we're on one of those URLs, redirect away.
foreach( $not_allowed as $check ) {
if( strpos( strtolower( $uri ), strtolower( $check ) ) !== false ) {
// Go to levels page. Change if wanted.
wp_redirect( pmpro_url( 'levels' ) );
exit;
}
}
}
add_action( 'template_redirect', 'my_redirect_nonmembers' );
jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
An API key is used by a lot of Web API to provide a form of access control. The key usually is linked to the identity of the API user as well as bundle of rights like a quota or areas of the APIs which are open for access to that key
<?php// get the HTTP method, path and body of the request$method = $_SERVER['REQUEST_METHOD'];$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));$input = json_decode(file_get_contents('php://input'),true);// connect to the mysql database$link = mysqli_connect('localhost', 'root', 'root', 'myDB');mysqli_set_charset($link,'utf8');// retrieve the table and key from the path$table = preg_replace('/[^a-z0-9_]+/i','',array_shift($request));$key = array_shift($request)+0;// escape the columns and values from the input object$columns = preg_replace('/[^a-z0-9_]+/i','',array_keys($input));$values = array_map(function ($value) use ($link) {if ($value===null) return null;return mysqli_real_escape_string($link,(string)$value);},array_values($input));// build the SET part of the SQL command$set = '';for ($i=0;$i<count($columns);$i++) {$set.=($i>0?',':'').'`'.$columns[$i].'`=';$set.=($values[$i]===null?'NULL':'"'.$values[$i].'"');}// create SQL based on HTTP methodswitch ($method) {case 'GET':$sql = "select * from `myform`".($key?" WHERE id=$key":''); break;case 'PUT':$sql = "update `myform` set $set where id=$key"; break;case 'POST':$sql = "insert into `myform` set $set"; break;case 'DELETE':$sql = "delete `myform` where id=$key"; break;}// excecute SQL statement$result = mysqli_query($link,$sql);// die if SQL statement failedif (!$result) {http_response_code(404);die(mysqli_error());}// print results, insert id or affected row countif ($method == 'GET') {if (!$key) echo '[';for ($i=0;$i<mysqli_num_rows($result);$i++) {echo ($i>0?',':'').json_encode(mysqli_fetch_object($result));}if (!$key) echo ']';} elseif ($method == 'POST') {echo mysqli_insert_id($link);} else {echo mysqli_affected_rows($link);}// close mysql connectionmysqli_close($link);?>
View this post on Instagram A post shared by WebCodeAddict (@webcodeaddicted)