Skip to content

Instantly share code, notes, and snippets.

View ioniacob's full-sized avatar
🐌
Exploring the code is like life itself.

Ion Iacob ioniacob

🐌
Exploring the code is like life itself.
View GitHub Profile
<!--
Via: http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
-->
<textarea class="js-copytextarea">Hello I'm some text</textarea>
<button class="js-textareacopybtn">Copy Text</button>
<script>
@sc0ttkclark
sc0ttkclark / add-product-to-cart.php
Last active March 5, 2020 08:28 — forked from kloon/gist:2376300
WooCommerce Automatically add product to cart on site visit
<?php
/*
* This code goes into theme functions.php or a custom plugin
*/
/**
* Add product to cart on page load
*/
function add_product_to_cart() {
/**
* Block Negative Balances
* Stop users from logging into your website if they have a negative
* myCRED balance.
* @version 1.0
*/
add_filter( 'authenticate', 'mycred_block_negative_balances', 990, 3 );
function mycred_block_negative_balances( $user, $username, $password ) {
// Make sure myCRED is installed
/**
* Insert Comment Appreciation
* Lets insert the mycred_send shortcode after the comment
* text if a user can afford to use it (and is logged in.
* @version 1.0.1
*/
add_filter( 'comment_text', 'my_custom_comment_text', 10, 2 );
function my_custom_comment_text( $comment_text, $comment = NULL ) {
// Make sure the current user is logged in
@amdrew
amdrew / affiliate-info.php
Last active May 22, 2022 20:54
AffiliateWP - Affiliate Info. Retrieve affiliate information via PHP function calls
<?php
$info = affiliatewp_affiliate_info()->functions;
$name = $info->get_affiliate_name();
$email = $info->get_affiliate_email();
$website = $info->get_affiliate_website();
$bio = $info->get_affiliate_bio();
$gravatar = $info->get_affiliate_gravatar();
$twitter = $info->get_twitter_username();
@ioniacob
ioniacob / Wordpress functions.php
Last active September 12, 2015 18:47
Personal Wordpress functions.php
// Additional Functions
// =============================================================================
add_action( 'affwp_process_register_form', 'affwp_custom_process_register_form' );
/* Auto enables the "Enable New Referral Notifications" checkbox on the "Settings" tab of the affiliate area when an affiliate is added. */
function affwp_custom_auto_enable_affiliate_referral_notifications( $add ) {
update_user_meta( affwp_get_affiliate_user_id( $add ), 'affwp_referral_notifications', true );
}
add_action( 'affwp_insert_affiliate', 'affwp_custom_auto_enable_affiliate_referral_notifications' );
/** Adds a log out link to the top of the affiliate area */
@escopecz
escopecz / commands.php
Last active April 18, 2023 22:43 — forked from alanhartless/cron.php
Script to run Mautic (https://mautic.org) commands from a URL.
<?php
if (!isset($_GET['ILoveMauticReallyIDo'])) {
echo 'The secret phrase is wrong.';
die;
}
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$allowedTasks = array(
'cache:clear',
@ultimatemember
ultimatemember / gist:643cd90967e5e415378d
Last active June 20, 2020 21:32
Custom profile tab example: showing user pages
/* add a custom tab to show user pages */
add_filter('um_profile_tabs', 'pages_tab', 1000 );
function pages_tab( $tabs ) {
$tabs['pages'] = array(
'name' => 'Pages',
'icon' => 'um-faicon-pencil',
'custom' => true
);
return $tabs;
}
@paulcollett
paulcollett / functions.php
Last active December 19, 2023 04:42
Remove Yoast HTML Comments “This site is optimized with the Yoast WordPress SEO plugin”
// For Yoast SEO Plugin Version: 14.1+ add to your Wordpress Theme's functions.php...
// Remove All Yoast HTML Comments
// https://gist.github.com/paulcollett/4c81c4f6eb85334ba076
// Credit @devendrabhandari (https://gist.github.com/paulcollett/4c81c4f6eb85334ba076#gistcomment-3303423)
add_filter( 'wpseo_debug_markers', '__return_false' );
// For Yoast SEO Plugin Version: < 14.1 add to your Wordpress Theme's functions.php...
@amdrew
amdrew / gist:7f22b058a5defb240c48
Last active March 15, 2016 14:41
OptimizeMember + AffiliateWP. Allow affiliates to login/register and still be redirected to the affiliate area
function affwp_custom_op_login_redirect( $return, $vars ) {
$user_id = $vars['user_id'];
if ( function_exists( 'affwp_is_affiliate' ) && affwp_is_affiliate( $user_id ) ) {
$return = false;
}
return $return;
}