Skip to content

Instantly share code, notes, and snippets.

View olar94's full-sized avatar

olar94

  • Moldova
View GitHub Profile
@olar94
olar94 / subcategory.php
Created September 3, 2018 21:34
subcategory page template
<?php
/*
Template Name: Category-Administrative
*/
?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/style.css" type="text/css" media="screen" />
@olar94
olar94 / gist:09dc3f7c71a6004c561a33043006799b
Last active September 3, 2018 21:41
add new post button
<?php if ( is_user_logged_in() ) { ?>
<div class="add_post"><a href="https://youthyork.eu/frontend-editor/">Write new post</a> </div>
<?php } ?>
.add_post{
-webkit-transform: rotate(-90deg); /*Поворот блока с текстом н 30 градусов*/
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
@olar94
olar94 / lol.php
Created September 4, 2018 14:11
Add product to cart and setting up custom price | woocommerce
global $woocommerce;
$woocommerce->cart->empty_cart(); //чистим
$custom_price = $price; //$price - переменная с ценой
$product_id = 11963; //id любого товара
$quantity = 1; //кол-во
$cart_item_data = array('custom_price' => $custom_price);
$woocommerce->cart->add_to_cart( $product_id, $quantity, $variation_id, $variation, $cart_item_data );
$woocommerce->cart->calculate_totals();
$woocommerce->cart->set_session();
$woocommerce->cart->maybe_set_cart_cookies();