Skip to content

Instantly share code, notes, and snippets.

@vince844
vince844 / loop-custom.php
Created August 26, 2018 13:15 — forked from kevinwhoffman/loop-custom.php
WordPress - Custom Post Type Loop
<?php
$loop = new WP_Query( array(
'post_type' => 'Property',
'posts_per_page' => -1
)
);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<option value="A001">ABANO TERME</option>
<option value="A004">ABBADIA CERRETO</option>
<option value="A005">ABBADIA LARIANA</option>
<option value="A006">ABBADIA SAN SALVATORE</option>
<option value="A007">ABBASANTA</option>
<option value="A008">ABBATEGGIO</option>
<option value="A010">ABBIATEGRASSO</option>
<option value="A012">ABETONE</option>
<option value="M376">ABETONE CUTIGLIANO</option>
<option value="A013">ABRIOLA</option>
@vince844
vince844 / MyCred custom column for mycred_history log
Created October 15, 2017 18:53
MyCred custom column for mycred_history log shortcode
// Add the following code to the functions.php code it will add a new column in the mycred_history with the user fisrt name and last name
function mycredpro_add_log_column( $columns ) {
// Add our own column
$columns['user-data'] = 'Utente';
return $columns;
}
@vince844
vince844 / Gravity Form passing value from checkbox to text field
Created October 15, 2017 08:48
Gravity Form passing value from checkbox to text field
<script>
var checkboxHandler = {
//Change these IDs to match your form
checkboxFieldId: 'input_1_25', //checkbox container ID
outputFieldId: 'input_1_23', //hidden field to capture values
checkboxField: null,
outputField: null,
@vince844
vince844 / MyCred update user points on Gravity Form submission
Last active October 13, 2018 06:08
MyCred update user points on Gravity Form submission
add_action( 'gform_after_submission_1', 'karibusana_update_mycred_user_balance', 10, 2 ); // Change 1 with the form ID
function karibusana_update_mycred_user_balance ($entry, $form) {
// Change 23 to the ID of the form field you want
$orderID = rgar($entry, '23');
$user_id = get_current_user_id();
// switch to mycred_add if you want to add points instead of subtract
if (function_exists('mycred_subtract')) {
@vince844
vince844 / Woocommerce and Groups Integration
Created May 27, 2017 16:34
Woocommerce and Groups Integration
// @karibusana.org Funzione per indirizzare gli utenti a diversi negozi a seconda del loro gruppo di appartenenza
function karibusana_change_woocommerce_button_url() {
$user_id = get_current_user_id();
$group = Groups_Group::read_by_name( 'Rivenditori' ); // Qui specifica il nome del gruppo per il quale eseguire il redirect
if ( Groups_User_Group::read( $user_id, $group->group_id ) ) {
$redirect_to = get_permalink( 1054 ); // inserisci qui l'id dela pagina rivenditori
//CREAZIONE NUOVA PAGINA UTENTE E ATTRIBUZIONE DELLE CAPABILITIES
add_action('user_register', 'registration_newpage');
function registration_newpage($user_id) {
$user_info = get_userdata($user_id);
$username = $user_info->user_login;
$post = array();
$post['post_name'] = $username; // Il permalink della pagina