Skip to content

Instantly share code, notes, and snippets.

👨‍💻
developing ...

Antonio Blanco eggemplo

👨‍💻
developing ...
Block or report user

Report or block eggemplo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eggemplo
eggemplo / change-slugs-cpt.php
Last active Aug 31, 2019
Change the custom posts type and custom taxonomies slugs.
View change-slugs-cpt.php
/**
* Author: Antonio Blanco Oliva
* Website: www.ablancodev.com
* Company: www.blancoleon.com
**/
function change_post_types_slug( $args, $post_type ) {
/*item post type slug*/
if ( 'portfolio' === $post_type ) {
if ( !is_array( $args['rewrite'] ) ) {
$args['rewrite'] = array( 'slug' => '' );
@eggemplo
eggemplo / mail.php
Created Apr 22, 2019
Envío de email usando la función mail() de php
View mail.php
<?php
// El mensaje
$mensaje = "Línea 1\r\nLínea 2\r\nLínea 3";
// Si cualquier línea es más larga de 70 caracteres, se debería usar wordwrap()
$mensaje = wordwrap($mensaje, 70, "\r\n");
// Enviarlo
mail('hello@example.com', 'Mi título', $mensaje);
?>
@eggemplo
eggemplo / functions.php
Created Mar 14, 2018
Extends the [groups_user_groups] shortcode to display the ids. This new shortcode is [groups_user_groups_id]
View functions.php
add_shortcode( 'groups_user_groups_id', 'itx_groups_user_groups_id' );
/**
* Renders the current or a specific user's groups id.
* Attributes:
* - "user_id" OR "user_login" OR "user_email" to identify the user, if none given assumes the current user
* - "format" : one of "list" "div" "ul" or "ol" - "list" and "ul" are equivalent
* - "list_class" : defaults to "groups"
* - "item_class" : defaults to "name"
* - "order_by" : defaults to "name", also accepts "group_id"
* - "order" : default to "ASC", also accepts "asc", "desc" and "DESC"
@eggemplo
eggemplo / affiliates_stored_affiliate.php
Created Jan 30, 2018
example of affiliates_stored_affiliate action
View affiliates_stored_affiliate.php
add_action( 'affiliates_stored_affiliate', 'connecting_crm_api_affiliates_stored_affiliate', 10, 2 );
function connecting_crm_api_affiliates_stored_affiliate ( $affiliate_id, $affiliate_user_id ) {
// This function is launched when a new affiliate is created
// Here you can add your crm api code
// ....
}
@eggemplo
eggemplo / function.php
Last active Jan 3, 2018
affiliates_check_confirmation_text
View function.php
add_filter( 'affiliates_check_confirmation_text', 'my_custom_affiliates_check_confirmation_text', 10, 1 );
function my_custom_affiliates_check_confirmation_text( $txt ) {
return '<p>' . 'Your custom text here'. '</p>';
}
@eggemplo
eggemplo / decent-comments-post-avatar.php
Created Nov 27, 2017
Display the post avatar on the decent-comments widgets.
View decent-comments-post-avatar.php
add_filter( 'decent_comments_comments_output', 'random_decent_comments_comments_output', 10, 3 );
function random_decent_comments_comments_output ( $output, $comments, $options ) {
extract( Decent_Comments_Renderer::$defaults );
// display options
if ( isset( $options['avatar_size'] ) ) {
$avatar_size = intval( $options['avatar_size'] );
} else {
$avatar_size = 32;
@eggemplo
eggemplo / functions.php
Created Aug 16, 2017
itthinx Groups - Auto group for media files
View functions.php
add_action('add_attachment', 'my_add_attachment');
function my_add_attachment ( $post_id ) {
$group_ids[] = 2;
Groups_Post_Access::update( array( 'post_id' => $post_id, 'groups_read' => $group_ids ) );
}
@eggemplo
eggemplo / functions.php
Created Aug 14, 2017
itthinx Groups Newsletters - autosusbcribed
View functions.php
add_action('user_register', 'my_user_register');
function my_user_register( $user_id ) {
if ( update_user_meta( $user_id, 'groups_newsletters_subscriber', 'yes' ) ) {
$hash = md5( time() + rand( 0, time() ) );
$datetime = date( 'Y-m-d H:i:s', time() );
update_user_meta( $user_id, 'groups_newsletters_hash', $hash );
update_user_meta( $user_id, 'groups_newsletters_datetime', $datetime );
}
}
@eggemplo
eggemplo / functions.php
Created Jul 18, 2017
Creates a group based on a field of Gravity Forms form.
View functions.php
add_action("gform_after_submission", "my_gform_after_submission", 10, 2);
function my_gform_after_submission ( $entry, $form ) {
$group_name = sanitize_text_field( trim( $entry['1'] ) ); // if the group's name is on the first field
if ( $group = Groups_Group::read_by_name( $group_name ) ) {
$group_id = $group->group_id;
} else {
$group_id = Groups_Group::create( array( 'name' => $group_name ) );
@eggemplo
eggemplo / functions.php
Created Jul 13, 2017
Fixes the Categories Widget count
View functions.php
function ix_change_term_counts( $terms, $taxonomies ) {
global $wp_query;
if ( is_admin() || is_ajax() ) {
return $terms;
}
if ( ! isset( $taxonomies[0] ) ) {
return $terms;
}
You can’t perform that action at this time.