This file contains hidden or 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 | |
add_filter( 'woocommerce_loop_add_to_cart_link', function ( $html, $product ) { | |
if ( is_user_logged_in() && is_shop() && $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) { | |
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data"><div class="ct-cart-actions">'; | |
$html .= woocommerce_quantity_input( array(), $product, false ); | |
$html .= '<button type="submit" class="single_add_to_cart_button button alt" name="add-to-cart" value="' . $product->get_id() . '">' . esc_html( $product->add_to_cart_text() ) . '</button>'; | |
$html .= '</div></form>'; | |
} | |
return $html; | |
}, 10, 2 ); |
This file contains hidden or 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
<script> | |
jQuery(document).ready(function($) { | |
$('.ct-filter').on( 'click', function(event){ | |
var $type = $(this).data("filter"); | |
if($type == "all"){ | |
$('.entry-card').fadeOut(0); | |
$('.entry-card').fadeIn(500); | |
} else { | |
$('.entry-card').hide(); | |
// For CPTs just change the category class to your CPTs slug for example: '.projects-' |
This file contains hidden or 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 | |
/* | |
* Code snippet to reject login for admin/authors from the regular login url | |
* In this example, people who have edit_posts permission is require special url string to login | |
* The URL need to be: https://yourdomain.com/wp-login.php?salt=your_random_url_string | |
* For normal users they can login without the special salt | |
* But If author or admin try to login it will reject the authentication | |
* | |
*/ |
This file contains hidden or 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 | |
/* | |
Name: YOURLS WordPress Widget | |
Description: A WordPress widget to display a YOURLS shorturl and QR code | |
Code URI: https://gist.github.com/joshp23/3f990e6ec36e24ba53985968bbfa89f1 | |
Author: Josh Panter | |
Author URI: https://unfettered.net | |
====================================================================== | |
This widget will create &/or fetch the existing short URL for a WordPress post from YOURLS, | |
provide a button to copy the short url, and optionally display a qrcode. |