View custom-wp-login.php
<?php | |
/** | |
* Personalizamos la página de wp-login de WordPress. | |
* Cambiamos url, title y logo de la cabecera. | |
* Y favicon, tanto de wp-login como del admin en general. | |
**/ | |
// Login WordPress | |
add_filter( 'login_headerurl', 'my_login_headerurl' ); | |
function my_login_headerurl( $url ) { |
View new-woocommerce-order-status.php
// Register new 'shipped' (enviado) status | |
function register_shipped_order_status() { | |
register_post_status( 'wc-shipped', array( | |
'label' => 'Enviado', | |
'public' => true, | |
'exclude_from_search' => false, | |
'show_in_admin_all_list' => true, | |
'show_in_admin_status_list' => true, | |
'label_count' => _n_noop( 'Enviado (%s)', 'Enviado (%s)' ) | |
) ); |
View functions.php
function otgs_custom_hreflang( $hreflang_items ){ | |
if( is_array($hreflang_items) && !empty( $hreflang_items ) ){ | |
// Check if there are no translations available. | |
if( 1 == count( $hreflang_items ) ){ | |
return null; | |
} | |
} | |
return $hreflang_items; |
View functions.php
function my_custom_nav_menu_css_class( $classes, $item, $args ) { | |
if ( is_singular( 'curso' ) && 'Nuestros cursos' == $item->title ) { | |
$classes[] = 'active'; | |
} | |
return array_unique( $classes ); | |
} | |
add_filter( 'nav_menu_css_class', 'my_custom_nav_menu_css_class', 10, 3 ); |
View functions.php
function parent_and_child_scripts() { | |
// Parent | |
wp_enqueue_style( 'mytheme-parent-style', get_template_directory_uri(). '/style.css', array(), '0.0.1' ); | |
// Child | |
wp_enqueue_style( 'mytheme-child-style', get_stylesheet_directory_uri(). '/style.css', array(), '0.0.1' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'parent_and_child_scripts' ); |
View my-options.php
<?php | |
/* | |
Plugin Name: My options | |
Plugin URI: https://www.ablancodev.com | |
Description: Simple plugin with an ACF options page | |
Tags: plugin | |
Version: 0.1 | |
Author: Antonio Blanco | |
Author URI: https://www.ablancodev.com |
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' => '' ); |
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); | |
?> |
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" |
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 | |
// .... | |
} |
NewerOlder