Avisos
Vaciar todo

Hosting WordPress 70% dto Dominios promo

problemas con h1 duplicado  

Página 1 / 2
 
Ricardo
 Ricardo
Usuario eminente

Buenos días Pepe.

Tengo un problema con los H1, si pongo en el primer encabezado h1 yoast me dice:
Título único: Solo se debería usar H1 como tu título principal. Encuentra todos los H1 en tu texto que no sean el título principal y ¡cámbialos a un nivel de encabezado inferior!
Supongo que tendre algun H1 en el titulo pero, no se como quitarlo.
La web es www.paradelgazar.org y el temas es Astra.

Que puédo hacér?

Citar
Respondido : 19/08/2020 10:03 am
Pepe
 Pepe
Soporte CMS Webempresa Admin

Hola Ricardo.

Prueba añadir la siguiente función al archivo functions.php que encontrarás dentro de wp-content -> themes -> Tu_plantilla.

add_action( 'wp', 'astra_add_title_filter' );

/**
* Function to add filters to change titles.
*
* @return void
*/
function astra_add_title_filter() {
add_filter( 'astra_the_title_before', 'astra_the_title_before_tag', 1, 10 );
add_filter( 'astra_the_title_after', 'astra_the_title_after_tag', 1, 10 );
}

/**
* Function to change tag in all titles.
*
* @param string $tag This contains default tag used for the titles.
* @return string
add_action( 'wp', 'astra_add_title_filter' );

/**
* Function to add filters to change titles.
*
* @return void
*/
function astra_add_title_filter() {
add_filter( 'astra_the_title_before', 'astra_the_title_before_tag', 1, 10 );
add_filter( 'astra_the_title_after', 'astra_the_title_after_tag', 1, 10 );
}

/**
* Function to change tag in all titles.
*
* @param string $tag This contains default tag used for the titles.
* @return string
*/
function astra_the_title_before_tag( $tag ) {
$tag = '<h4>';
return $tag;
}

/**
* Function to change tag in all titles.
*
* @param string $tag This contains default tag used for the titles.
* @return string
*/
function astra_the_title_after_tag( $tag ) {
$tag = '</h4>';
return $tag;
}

 

Tienes más información en este enlace:

-> https://wpastra.com/docs/change-heading-tag-for-post-title/

 

Un saludo

 

ResponderCitar
Respondido : 19/08/2020 10:51 am

Gestor de Contraseñas - VPN Conexión Segura - Gestor 2FA (Segundo Factor de Autenticación

Ricardo
 Ricardo
Usuario eminente

Cuando pongo el código me dice lo siguiente: los cambios en tu código PHP se han revertido debido a un error en la línea 37 del archivo wp-content/themes/astra/functions.php. Por favor, arréglalo y trata de guardar de nuevo.
37  }

ResponderCitar
Respondido : 19/08/2020 11:30 am
Pepe
 Pepe
Soporte CMS Webempresa Admin

Hola Ricardo.

Al parecer tienes una función con el mismo nombre.

Revisa si en esa línea tienes algo parecido a esto y lo eliminas:

/**
* Function to change tag in all titles.
*
* @param string $tag This contains default tag used for the titles.
* @return string
*/
function astra_the_title_after_tag( $tag ) {
$tag = '</h4>';
return $tag;
}

 

Un saludo

ResponderCitar
Respondido : 19/08/2020 11:45 am

Cursos Gratuitos WordPress

Ricardo
 Ricardo
Usuario eminente

Perdona por la insistencia pero ahora me da el siguiente error:

Los cambios en tu código PHP se han revertido debido a un error en la línea 209 del archivo wp-content/themes/astra/functions.php. Por favor, arréglalo y trata de guardar de nuevo.

syntax error, unexpected end of file

209 require_once ASTRA_THEME_DIR . 'inc/core/deprecated/deprecated-functions.php';

Es la ultima fila

ResponderCitar
Respondido : 19/08/2020 11:52 am
Pepe
 Pepe
Soporte CMS Webempresa Admin

Hola Ricardo.

Ok, añade el código desde el administrador de archivos de tu cuenta de cPanel.

.- Accede a la carpeta wp-content -> themes -> Astra y edita el archivo functions.php.

Añade el código al final de ese archivo.

 

Tienes una guia de como trabajar con el administrador de archivos en este enlace:

-> https://guias.webempresa.com/preguntas-frecuentes/administrador-archivos-cpanel/

 

Un saludo

 

ResponderCitar
Respondido : 19/08/2020 12:05 pm

optimiza-automaticamente-todas-las-imagenes-de-tu-wordpress

Ricardo
 Ricardo
Usuario eminente

@pepesoler

He seguido tus instrucciones pero cuando cargo la web me dice:

Ha habido un error crítico en tu web.

Lo he borrado el codigo y ahora se vuelve a ver.

ResponderCitar
Respondido : 19/08/2020 12:17 pm
Karen Rios
 Karen Rios
Soporte CMS Webempresa Moderator

Hola Ricardo,

He ingresado a tu sitio web y veo que esta marcando el error critico y no se visualiza, estas realizando cambios? si es posible envíanos una captura del código que estas insertando en tu tema.

Un Saludo

ResponderCitar
Respondido : 19/08/2020 1:19 pm

wpdoctor-revisa-la-salud-de-tu-wordpress

Ricardo
 Ricardo
Usuario eminente

@karen

Hola karen.

Acabo de hacer un backup del archivo public y ahora esta todo bien.

El código que he intentado insertar es:

add_action( 'wp', 'astra_add_title_filter' );

/**
* Function to add filters to change titles.
*
* @return void
*/
function astra_add_title_filter() {
add_filter( 'astra_the_title_before', 'astra_the_title_before_tag', 1, 10 );
add_filter( 'astra_the_title_after', 'astra_the_title_after_tag', 1, 10 );
}

/**
* Function to change tag in all titles.
*
* @param string $tag This contains default tag used for the titles.
* @return string
add_action( 'wp', 'astra_add_title_filter' );

/**
* Function to add filters to change titles.
*
* @return void
*/
function astra_add_title_filter() {
add_filter( 'astra_the_title_before', 'astra_the_title_before_tag', 1, 10 );
add_filter( 'astra_the_title_after', 'astra_the_title_after_tag', 1, 10 );
}

/**
* Function to change tag in all titles.
*
* @param string $tag This contains default tag used for the titles.
* @return string
*/
function astra_the_title_before_tag( $tag ) {
$tag = '<h4>';
return $tag;
}

/**
* Function to change tag in all titles.
*
* @param string $tag This contains default tag used for the titles.
* @return string
*/
function astra_the_title_after_tag( $tag ) {
$tag = '</h4>';
return $tag;
}
ResponderCitar
Respondido : 19/08/2020 4:35 pm
Karen Rios
 Karen Rios
Soporte CMS Webempresa Moderator

Hola Ricardo,

De acuerdo, si deseas puedes probar realizar esto en un childtheme de tu tema. Veo que desde su web oficial se genera de forma automática

-> Contenido solo visible a usuarios registrados

Guarda los cambios y verifica todo este funcionando de forma correcto

Un Saludo

ResponderCitar
Respondido : 19/08/2020 4:54 pm

Ricardo
 Ricardo
Usuario eminente

@karen

Una pena, Yoast sigue dandome el mismo resultado.

Título único: Solo se debería usar H1 como tu título principal. Encuentra todos los H1 en tu texto que no sean el título principal y ¡cámbialos a un nivel de encabezado inferior!

ResponderCitar
Respondido : 19/08/2020 5:19 pm
Jhon
 Jhon
Soporte CMS Webempresa Moderator

Hola

El código que estas tratando de insertar es incorrecto porque hay un nombre función que esta repetido, elimina el código, prueba simplemente con el siguiente código:

add_action( 'wp', 'astra_add_title_filter' );

function astra_add_title_filter() {
add_filter( 'astra_the_title_before', 'astra_the_title_before_tag', 1, 10 );
add_filter( 'astra_the_title_after', 'astra_the_title_after_tag', 1, 10 );
}

function astra_the_title_before_tag( $tag ) {
$tag = '<h4>';
return $tag;
}

function astra_the_title_after_tag( $tag ) {
$tag = '</h4>';
return $tag;
}

Lo que veo que ehace este código es cambiar el tag del título a h4

Saludos.

ResponderCitar
Respondido : 19/08/2020 5:33 pm

Gestor de Contraseñas - VPN Conexión Segura - Gestor 2FA (Segundo Factor de Autenticación

Ricardo
 Ricardo
Usuario eminente

@jmarreros

No veo cambios, creo sigue todo igual.

ResponderCitar
Respondido : 19/08/2020 5:43 pm
Jhon
 Jhon
Soporte CMS Webempresa Moderator

Hola

Envíanos la url exacta en tu sitio en donde supuestamente te aparecen h1 duplicados para verificar si realmente es el título u otra cosa.

Saludos.

ResponderCitar
Respondido : 19/08/2020 6:50 pm

Cursos Gratuitos WordPress

Ricardo
 Ricardo
Usuario eminente

@jmarreros

https://paradelgazar.org

En todas las urls de la web me pasa lo mismo

https://paradelgazar.org/mejores-pastillas/

https://paradelgazar.org/mejores-cremas/

Y así todas las urls

 

ResponderCitar
Respondido : 19/08/2020 7:20 pm
Página 1 / 2