Skip to content

Instantly share code, notes, and snippets.

@A1daris
A1daris / button.sass
Created April 18, 2017 18:22 — forked from agragregra/button.sass
Button Sass Styles (Universal Starter)
.button
display: inline-block
border: none
color: #fff
text-decoration: none
background-color: $accent
padding: 15px 45px
font-size: 13px
text-transform: uppercase
font-weight: 600
@A1daris
A1daris / woo_functions.php
Created February 6, 2017 17:04
woo products per page
// Display 6 products per page. Goes in functions.php
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 6;' ), 20 );
@A1daris
A1daris / page.php
Created January 27, 2017 09:56
Woocommerce -- Sample products loop
//Template Name: My template
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
@A1daris
A1daris / woo_breadcrumb_functions.php
Created January 26, 2017 10:51
Removing breadcrumbs from home page in woocommerce
function bob_breadcrumb_fix() {
if (is_home()) {
remove_action('storefront_content_top', 'woocommerce_breadcrumb', 20);
}
}
add_action( 'wp_head', 'bob_breadcrumb_fix');
@A1daris
A1daris / function.php
Created January 21, 2017 13:54
Woocommerce header cart text
if ( ! function_exists( 'storefront_cart_link' ) ) {
function storefront_cart_link() {
?>
<a class="cart-contents" href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" title="<?php _e( 'View your shopping cart', 'storefront' ); ?>">
<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) );?></span>
</a>
<?php
}
}
@A1daris
A1daris / form.js
Last active January 14, 2017 10:54
Form to e-mail (js + php)
//send data from id=hidden_form to mail.php
$("#hidden_form").submit(function() {
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize()
}).done(function() {
$(this).find("input").val("");
//alert("Thank you!");
$("#hidden_form").trigger("reset");
HTML:
<div class="wrapper">
<div class="tabs">
<span class="tab">Вкладка 1</span>
<span class="tab">Вкладка 2</span>
<span class="tab">Вкладка 3</span>
</div>
<div class="tab_content">
<div class="tab_item">Содержимое 1</div>
<div class="tab_item">Содержимое 2</div>
<?php
$tags = get_tags();
if ($tags) {
foreach ($tags as $tag) {
echo '<p>Tag: <a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </p> ';
}
}
?>
<?php
$tags = wp_get_post_tags($post->ID);
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>