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 | |
/** | |
* @snippet Cómo autorellenar un campo select de Advanced Custom Fields con datos de una página de opciones | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/como-autorrellenar-un-campo-select-de-advanced-custom-fields-con-datos-de-una-pagina-de-opciones | |
*/ | |
// Función para recoger los datos del textarea de la página de opciones y autorrellenar el select | |
function oaf_acf_cargar_lista_opciones( $field ) { |
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 | |
/** | |
* @snippet Advanced Custom Fields: Crear página de opciones con sub-páginas. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/como-crear-una-pagina-de-opciones-en-wordpress-con-advaced-custom-fields-de-basico-a-avanzado | |
*/ | |
add_action('acf/init', 'oaf_pagina_opciones'); |
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 | |
/** | |
* @snippet Advanced Custom Fields: Crear página de opciones con página hija. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/como-crear-una-pagina-de-opciones-en-wordpress-con-advaced-custom-fields-de-basico-a-avanzado | |
*/ | |
add_action('acf/init', 'oaf_pagina_opciones'); | |
function oaf_pagina_opciones() { |
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 | |
/** | |
* @snippet Advanced Custom Fields: Opciones básicas para las páginas de opciones. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/como-crear-una-pagina-de-opciones-en-wordpress-con-advaced-custom-fields-de-basico-a-avanzado | |
*/ | |
add_action('acf/init', 'oaf_pagina_opciones'); |
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 | |
/** | |
* @snippet Advanced Custom Fields: Crear página de opciones super básica / mínima | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/como-crear-una-pagina-de-opciones-en-wordpress-con-advaced-custom-fields-de-basico-a-avanzado | |
*/ | |
if( function_exists('acf_add_options_page') ) { | |
acf_add_options_page(); |
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 | |
/** | |
* @snippet Advanced Custom Fields: Obtener todos los valores de un campo | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/advanced-custom-fields-obtener-todos-los-valores-de-un-campo | |
*/ | |
function oaf_cpt_acf_fields_to_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 | |
/** | |
* @snippet Condicionales WordPress: Comprobar si es un archivo de plantilla concreta - Template | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/condicionales-wordpress-comprobar-si-es-un-fichero-de-plantilla | |
*/ | |
if (is_page_template('crear-post-acf.php')){ | |
echo "Estamos en la plantilla: crear-post-acf.php"; |
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 | |
/** | |
* @snippet Condicionales WordPress: Comprobar si es un archivo de plantilla - Template | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/condicionales-wordpress-comprobar-si-es-un-fichero-de-plantilla | |
*/ | |
if ( is_page_template() ){ | |
echo "Estamos en una template"; |
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 | |
/** | |
* @snippet Encolar archivo css para el backend de WordPress - Admin | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/anadir-css-en-el-backend-de-wordpress/ | |
*/ | |
// Encolar estilos para el back - Admin | |
function oaf_admin_style() { |