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 | |
//hook our function to the product variation | |
add_action( 'woocommerce_single_variation', 'fs_custom_variation_text', 18 ); | |
function fs_custom_variation_text() { | |
global $product; | |
// checking if the product is the correct product id | |
if ($product->id === 454) { |
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 | |
/** | |
* Filter the display value for a column | |
* | |
* @param mixed $value Custom field value | |
* @param int $id Object ID | |
* @param AC_Column $column Column instance | |
*/ | |
function ac_my_custom_field_column_value_example( $value, $id, $column ) { |
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 //remove this line if using in Snippets | |
// Usage: [auth_app_link] | |
add_shortcode( 'auth_app_link', 'generate_auth_app_link_shortcode' ); | |
function generate_auth_app_link_shortcode( $atts, $content ) { | |
// Set variables to create an authentication token that will be passed to some other pages | |
// use a salt "key" to further hash the token | |
$salt = 'sdfj8sad9f8jasf9jsd'; |
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 | |
/* --- | |
By default, Ultimate Member prevents backend access unless explicitily allowed via each role | |
In fact, if they have NUMEROUS roles, and only ONE of those roles was explicitiy given backend permission, the user still won't have access since their other roles are restricting it | |
So we take THEIR OWN FUNCTION and remove it. So now it won't matter if the UM role has "wp-admin" access or not. | |
--- */ | |
function remove_um_admin_block_action() { | |
remove_action('init','um_block_wpadmin_by_user_role',99); | |
} | |
add_action('init','remove_um_admin_block_action'); |
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 | |
// https://www.proy.info/woocommerce-allow-only-1-product-per-category/ | |
// Allow only one(or pre-defined) product per category in the cart | |
// Alternatively, try plugin: https://wordpress.org/plugins/woo-cart-limit/ | |
add_filter( 'woocommerce_add_to_cart_validation', 'allowed_quantity_per_category_in_the_cart', 10, 2 ); | |
function allowed_quantity_per_category_in_the_cart( $passed, $product_id) { | |
$max_num_products = 1;// change the maximum allowed in the cart | |
$running_qty = 0; |
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 | |
// create shortcode to list all Featured Itineraries | |
add_shortcode( 'all-featured-itineraries', 'fs_all_featured_itineraries_shortcode' ); | |
function fs_all_featured_itineraries_shortcode( $atts ) { | |
ob_start(); | |
// Query posts from the database. | |
$options = array( | |
// Arguments for your query. | |
'post_type' => 'collections', |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in [NC] | |
RewriteRule (^|/)uploads/private/.+?\.(.*)$ login/?redirect_to=/portal/ [R,L] | |
</IfModule> |
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(function() { | |
jQuery('.wpk-chmura form input[name="title"]').keypress(function(e) { | |
var key = e.which; | |
// the enter key code | |
if (key == 13) { | |
jQuery('.wpk-chmura form input[type="button"]').click(); | |
return false; | |
} |
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 | |
/** | |
* https://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters | |
* On the page that is set to be the blog homepage (Posts Page), exclude a post from the loop, if it has a certain tag ID | |
**/ | |
// exclude posts from the main blog loop, if it has the Focus tag | |
function fs_exclude_specific_tag( $query ) { | |
if ( !is_admin() && $query->is_home() && $query->is_main_query() ) { | |
// $query->set( 'tag', '-141' ); |
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 | |
/** | |
* Define default terms for custom taxonomies in WordPress 3.0.1 | |
* | |
* @author Michael Fields http://wordpress.mfields.org/ | |
* @props John P. Bloch http://www.johnpbloch.com/ | |
* @props Evan Mulins https://circlecube.com/circlecube/ | |
* | |
* @since 2010-09-13 | |
* @alter 2013-01-31 |