- This topic has 18 replies, 3 voices, and was last updated 4 years, 5 months ago by
Tom.
-
AuthorPosts
-
December 26, 2018 at 4:29 am #765681
jmpefe78gmail-com
Hola, necesito insertar el dato estructurado “article” y algunos otros de forma individual a cada entrada de WordPress
¿Cómo puedo meter con Generatepress códigos scripts de forma individual para cada entrada?
Gracias
December 26, 2018 at 9:01 am #765977jmpefe78gmail-com
¿Por qué Generapress no usa ni article ni blogposting en el marcado de datos del post?
December 26, 2018 at 9:10 am #765986Tom
Lead DeveloperLead DeveloperBlogPosting
requires some fields that we don’t provide by default, so we default toCreativeWork
for now.You can change it to
BlogPosting
like this:add_filter( 'generate_article_itemtype', function( $type ) { return 'BlogPosting'; } );
December 26, 2018 at 9:26 am #766001jmpefe78gmail-com
Ok, ¿es mejor creative work que article? ¿Qué diferencia hay? gracias Tom
December 26, 2018 at 9:47 am #766016jmpefe78gmail-com
Y disculpa de nuevo, ¿dónde tengo que insertar ese código? ¿Y no es mejor usar article en vez de “blogposting” ?
December 26, 2018 at 10:03 am #766024jmpefe78gmail-com
He metido ese código en el funtions php pero no es lo que quiero, yo solo quiero que article sea para los post del blog no para la home y demás páginas
December 26, 2018 at 11:00 am #766069Leo
StaffCustomer SupportTry this:
add_filter( 'generate_article_itemtype', function( $type ) { if ( is_single() ) { return 'BlogPosting'; } } );
December 26, 2018 at 11:28 am #766079jmpefe78gmail-com
Genera errores ese código al usar el probado de datos estructurados tanto en las páginas como en los post.
¿Qué puedo hacer? creo que usar article es importante para el SEO.
December 26, 2018 at 1:34 pm #766148jmpefe78gmail-com
A ver si podéis darme otra solución ya que ese código genera errores!
December 26, 2018 at 9:34 pm #766328Tom
Lead DeveloperLead DeveloperHi there,
Try this instead:
add_filter( 'generate_article_itemtype', function( $type ) { if ( 'post' === get_post_type() ) { return 'BlogPosting'; } return $type; } );
The type you use depends on your content. You can definitely use
Article
instead if that suits your content better.December 26, 2018 at 11:38 pm #766364jmpefe78gmail-com
Este último código genera un error y una advertencia:
publisher MISSING_FIELD_WITHOUT_TYPE
[object Object]:mainEntityOfPage MISDecember 27, 2018 at 9:24 am #766806jmpefe78gmail-com
¿Otra solución? Gracias
December 27, 2018 at 9:24 am #766807Tom
Lead DeveloperLead DeveloperYes – that’s one of the reasons we use CreativeWork by default. You’ll also need a publisher value set with a logo.
If you’re not super familiar with schema.org, it may be better to disable the GP microdata and use a JSON-LD plugin.
That will give you more options/instructions.
To disable the default schema, you can add this PHP:
add_filter( 'generate_schema_type', '__return_false' );
December 27, 2018 at 9:27 am #766817jmpefe78gmail-com
No es mi idea, me gusta el marcado que tiene Generatepress y no estoy muy familiarizado con el código pero pero creo que usar article es fundamental. ¿No hay otra opción?
December 27, 2018 at 9:56 am #766846Tom
Lead DeveloperLead DeveloperIn order to change the schema type in GP, you would need to understand the schema type you are changing to and what’s required to add/remove within your content.
In some cases, it’s easier to go with a JSON-LD plugin that does that kind of stuff for you, unless you know exactly what you need to add/remove.
-
AuthorPosts
- You must be logged in to reply to this topic.