This file contains 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
/* | |
** Contact Form 7 Styles | |
*/ | |
.wpcf7-form input[type="text"], | |
.wpcf7-form input[type="email"], | |
.wpcf7-form input[type="url"], | |
.wpcf7-form input[type="password"], | |
.wpcf7-form input[type="search"], | |
.wpcf7-form input[type="number"], | |
.wpcf7-form input[type="tel"], |
This file contains 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
// SOURCE: https://community.generateblocks.com/t/grid-items-with-different-content-heights-aligned-bottom-block/36 | |
// | |
// If you have grid items in a row with different height contents, | |
// you may want to pin the last block (a button, for example) to the bottom of the grid items | |
// so they all align in the row. This is a popular look with pricing tables, for example. | |
// As of right now, there is no option for this, but it can be done with some simple CSS. | |
// First, give your Container block a custom class: my-custom-class. | |
// Then, add the following CSS: | |
.my-custom-class .gb-inside-container { |
This file contains 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
// SOURCE: https://generatepress.com/forums/topic/use-query-loop-to-display-the-events-calendar-events-on-home-page/ | |
// | |
// Mostrar solo eventos futuros | |
// GeneratePress, GenerateBlocks, ACF | |
// Hay que añadir clase personalizada al grid del query loop para discriminar sobre el resto de query loops | |
// En este caso usamos fecha en formato Ymd porque es como guarda ACF las fechas de date picker en la DB | |
function mafs_agenda_show_future_events( $query_args, $attributes ) { | |
if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'mostrar-agenda-futura' ) !== false ) { | |
$custom_args = array( |
This file contains 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 | |
/** Redimensionar al subir la imagen completa al tamaño grande de los ajustes de medios */ | |
/** SOURCE: https://ayudawp.com/redimensionar-imagenes-grandes/ */ | |
function ayudawp_reemplazar_imagen_subida($image_data) { | |
// si no hay imagen grande : return | |
if (!isset($image_data['sizes']['large'])) | |
return $image_data; | |
// ruta a la imagen subida y a la imagen grande | |
$upload_dir = wp_upload_dir(); |
This file contains 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 | |
function mafs_updated_send_email( $post_id ) { | |
// If this is just a revision, don't send the email. | |
if ( wp_is_post_revision( $post_id ) ) | |
return; | |
$post_title = get_the_title( $post_id ); | |
$post_url = get_permalink( $post_id ); | |
$subject = 'A post has been updated'; |
This file contains 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 | |
/** | |
* Limit WordPress media uploader maximum upload file size | |
* Uploading very large images is pointless as they will hardly ever be used at full size. | |
* Crunching larger files takes more memory; larger files take more space too. | |
* @author https://gist.github.com/unfulvio/1ee103a6f86893771b5a | |
* @param mixed $file the uploaded file item to filter | |
* @return array $file the filtered file item with response | |
*/ |
This file contains 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 | |
// Auto-populate end date if it is empty. | |
function mafs_update_data_final( $value, $post_id, $field ) { | |
//NOTE: don't use get_field() because it retrieves the value | |
//in a preformatted way different as it is saved in database | |
$data_final = get_post_meta( $post_id, 'doc_data_final', true ); | |
$data_inicial = get_post_meta( $post_id, 'doc_data_inici', true ); | |
//Check if data_final is empty (when saving) and data_inicial |
This file contains 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 | |
// Esta función permite imprimir el formulario adecuado dependiendo del idioma. | |
// Lo único que hay que tener en cuenta es que cuando creamos el título del formulario | |
// Hay que hacerlo siguiendo esta norma: "nombre del formulario" + " __" + slug del idioma. | |
// Ejemplo: ESP: "formulario __es", CAT: "formulario __ca", ENG: "formulario __en" | |
// En este ejemplo concreto, habría que llamar la función así: | |
// mafs_print_currentlang_form( 'formulario' ); | |
function mafs_print_currentlang_form( $form_name ) { |
This file contains 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 | |
function show_advanced_tools_bar_tiny_mce( $args ) { | |
$args['wordpress_adv_hidden'] = false; | |
return $args; | |
} | |
add_filter( 'tiny_mce_before_init', 'show_advanced_tools_bar_tiny_mce' ); |
This file contains 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 | |
// ---------------------------------------------------------------------- | |
// ----------------------- Custom post status --------------------------- | |
// ---------------------------------------------------------------------- | |
// "premsa" es el post status | |
// "publicacio" el cpt asociado. | |
// Create a custom post status | |
function mafs_new_archive_post_status() { | |
register_post_status( 'premsa', array( |
NewerOlder