22Logo WordpressRich Snippets Codice per Tesi a tema

In risposta ad una query Darko Kovan-Cives Mio pre-vi-dente art-icolo su[int­link id=“1520” type=“post”]fixing Rich Snip­pets code for the Mys­tique theme[/intlink] we have resolved the same issues with the Thes­is theme. Details of the changes required are below.

Before the file edits you need to carry out vari­ous oth­er changes and tasks

  1. Prendi un pro-file di google (i.e. un account google )
  2. Aggiungere l'indirizzo del tuo sito (per esempio. https://diymediahome.org) al pro-file di google , come collegamento pub-blico
  3. Get your google plus ID and use it in place of mine in file edit num­ber 5 below
  4. Change a Thes­is set­ting for show­ing author on teas­ers in the options — Thes­is: Opzioni di design: Tè-tori: Teas­er Dis­play Options: Tick ​​"nome dell'autore"
  5. Change a Thes­is set­ting for link­ing author in options — Thes­is: Opzioni di design: Opzioni Dis-play: Bylines: "Nomi link all'autore di archivi"

Ora faccio il file modifica come segue

1. Modifica linea 151 in content.php al nido la durata fn all'interno di un arco vcard

da

[php htmlscript=“1”]echo __(‘by’, ‘thes­is’) . ” <span class=\“author vcard$fn\”>$autore</intervallo>”;[/php]

to

[php htmlscript=“1”]echo __(‘by’, ‘thes­is’) . ” <span class=\“vcard\”><span class=\“author $fn\”>$autore</intervallo></intervallo>”;[/php]

2. Modifica linea 114 in content.php per fornire data aggiornata così come data di pub-blicato

da

[php htmlscript=“1”]se ($data)
echo ‘<abbr class=“published” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time(get_option(‘date_format’)) . '</abbr>’;[/php]

to

[php htmlscript=“1”]se ($data){
se(get_the_date()!= Get_the_modified_date()){
echo ‘<abbr class=“published” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time(get_option(‘date_format’)) . '</abbr>. Aggiornato <abbr class=“updated” title=“ ‘ . get_the_modified_time(‘Y‑m-d’) . ’ ”>’ . get_the_modified_time(get_option(‘date_format’)) . '</abbr>’;
}
altro{
echo ‘<abbr class=“published updated” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time(get_option(‘date_format’)) . '</abbr>’;
}
}[/php]

3. Modifica linea 81 in teasers.php per includere data aggiornata

da

[php htmlscript=“1”]echo ‘<abbr class=“teaser_date pub­lished” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time($use_format) . "</abbr>\n”;[/php]

to

[php htmlscript=“1”]se(get_the_date()!= Get_the_modified_date()) echo ‘<abbr class=“teaser_date pub­lished” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time($use_format) . '</abbr><abbr class=“teaser_date updated” title=“ ‘ . get_the_modified_time(‘Y‑m-d’) . ’ ”><span class=“value-title” title=“ ‘.get_the_modified_time($use_format).’ ”></intervallo></abbr>’.”\n”;
else echo ‘<abbr class=“teaser_date pub­lished updated” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time($use_format) . "</abbr>\n”;[/php]

4. Modificare il codice href autore on line 144 di content.php aggiungere rel = "me"

da

[php htmlscript=“1”]$author = ‘<a href=“ ‘ . get_author_posts_url(get_the_author_ID()) . ’ ” class=“url fn“ ‘ . $nofol­low .’>’ . get_the_author() . '</un>’;[/php]

to

[php htmlscript=“1”]$author = ‘<a rel=“me” href=“ ‘ . get_author_posts_url(get_the_author_ID()) . ’ ” class=“url fn“ ‘ . $nofol­low .’>’ . get_the_author() . '</un>’;[/php]

5. Modifica linea 308 in content.php inserire collegamento account Google

da

[php htmlscript=“1”]$output .= “$tab\t<h1>” . apply_filters(‘thesis_archive_intro_headline’, get_author_name($WP_Query->query_vars[‘author’])) . "</h1>\n”; #wp[/php]

to

[php htmlscript=“1”]$output .= “$tab\t<h1><a rel=\“me\” href=\“https://plus.google.com/104657888470728381512/\”>” . apply_filters(‘thesis_archive_intro_headline’, get_author_name($WP_Query->query_vars[‘author’])) . "</un></h1>\n”; #wp[/php]

lascia un commento

22 Commenti

JSJon Scaife

Yes — I’ve had some syn­tax cor­rup­ted by the word­press code edit­or and by a plu­gin. Ho la speranza-completamente risolto adesso e sarà doppio controllo-zione il codice a tutti i messaggi nel week-end. Mi dispiace che!

rispondere
TTodd

Grazie Jon. Bril-liant fix. The Thes­is’ hcard errors cleaned up nicely.
Stiamo HAV-ING un problema correlato che forse saprete la risposta per. Abbiamo un po '-zione cod gen-er-a-zione del hrecipe format-ting e può vedere le marcature quando gli elementi post-ispezione-ing, ma i ricchi strumento snip-pet non è pick-ing è affatto. Lo sviluppatore non ha problemi get-ting raccolto sul suo sito e OTH-tori si è costruita su, but for some reas­on it isn’t get­ting picked up on a Thes­is theme.

Non so se questo è nel vostro round-casa, but if you could take a look that would be awesome.

Ecco un post del nostro con il codice: Roas-ted Straw-berry Muffin
Ecco uno di lei con il markup: Muffins Apple salsa

Grazie ancora per la correzione pre-vi-dente e per tutto l'aiuto che possono offrire.

rispondere
TTodd

Ho capito la risposta. La ricetta era avvolto in un tag di blocco preventivo. I changed that to a div tag and everything ran through perfect.

Thanks again on the pre­vi­ous hcard coding.

T

rispondere
JSJon Scaife

Credo che tu abbia confuso la tua rel = "me" e rel = "author" tag un po '

Si dovrebbe avere un solo rel = "me" link - dalla tua pagina dell'autore al pro-file di google. ogni-dove altro si dovrebbe avere tag rel = "author". Sulla vostra homepage ogni post ha un link "di Wouter de Jong", che punti (correttamente) alla tua pagina dell'autore ), ma avete rel = "me" su questi link. Dovrebbe essere rel = "author"

Una volta che si modificano questi rel = "me" link in rel = "author" Penso che tutto il lavoro - così com'è hai avuto mul-tiple rel = "me" link sulla vostra pagina dell'autore, la maggior parte di essi a se stessa e solo 1 (correttamente) point-zione al pro-file di google. Penso che questo è con-fus-ing lo strumento snip-pet

rispondere
SSante

Ciao Jon, it worked per­fectly — I did­n’t include items 4 e 5 from your list as they are not essen­tial to val­id­ate the rich snip­pet and I’m not bet­ting on Google+ just yet so I don’t want to “lit­ter” my themes 🙂

Thanks for the tip 🙂

rispondere
Laarafinshaon

HAV-zione guai @ Jon Scaife io non sono get-ting esattamente lo stesso codice in un file content.php. I’m using thes­is 1.8.2. wait-zione 4 la tua risposta ....

rispondere
Laarafinshaon

ho fatto esattamente questo. after doing this my Author­ship markup got veri­fied but unfor­tu­nately I’m get­ting below errors .

Warn-zione: Miss-ing campo obbligatorio "aggiornato".
Warn-zione: Almeno un campo deve essere impostato per hCard.
Warn-zione: Miss-ing campo obbligatorio "Nome (fn)”.

Devo attendere alcuni giorni per la scansione?

rispondere
JSJon Scaife

Qual è il tuo indirizzo del sito? Che pagina sei get-ting gli errori su? La homepage, un post o entrambi? Have you made any oth­er modi­fic­a­tions to the theme — like adding extra files or using a child theme?

rispondere
JSJon Scaife

Ci dispiace - colpa mia. Ho calcolato fuori. Il codice era rimasto storpiato per parola-press. I think when I update the post word­press pro­cesses some of the code and takes some of the classes out which makes it dis­func­tion­al. Ho COR-rec-ted esso. Si prega di dare una prova ora.

rispondere
EYEko Y

Grazie, molto Info use-ful. Ma, come aggiungere meta tag informano-a-zione come questo blog? Sembra che se faccio clic destro col browser »Info visualizzazione della pagina. There are many inform­a­tion on gen­er­al tab. Come Autore, View-port Etc. Il mio blog è solo con-tain : con-tent, robot, descrizioni zioni, keywords in page info..How to get this snippet?
Grazie..

rispondere
JSJon Scaife

Most of that comes from using a semant­ic HTML5 theme for word­press com­bined with the Yoast QUESTO plu-gin. Ho anche file meta vari-dente come humans.txt e robots.txt. Dai un'occhiata alla guida word-press per carichi di informare-a-zione sull'attuale configurazione parola premendo improv.

rispondere