{"id":232594,"date":"2023-01-21T13:38:00","date_gmt":"2023-01-21T10:38:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=232594"},"modified":"2022-11-10T11:28:56","modified_gmt":"2022-11-10T08:28:56","slug":"visualizzazione-degli-estratti-nelle-pagine-home-cerca-tag-e-archivio-di-wordpress","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/it\/visualizzazione-degli-estratti-nelle-pagine-home-cerca-tag-e-archivio-di-wordpress\/","title":{"rendered":"Visualizzazione degli estratti nelle pagine Home, Cerca, Tag e Archivio di WordPress"},"content":{"rendered":"<p>Mostrare solo gli estratti dei post nelle pagine home, ricerca, tag o archivio \u00e8 utile se i tuoi post sono particolarmente lunghi. I lettori non dovranno scorrere la pagina verso il basso per un particolare post.<\/p>\n<p>Puoi modificare il file modello <strong>content.php<\/strong> (consigliato usando un tema figlio), per passare a questa riga:<\/p>\n<pre><code>&lt;?php if (is_search() ): \/\/ Only display Excerpts for Search ?&gt;<\/code><\/pre>\n<p>e sostituirlo con:<\/p>\n<pre><code>&lt;?php if (is_search() || is_home() || is_tag() || is_category() || is_archive() ): \/\/ Only display Excerpts for Search ?&gt;<\/code><\/pre>\n<p>La funzione <strong>is_archive()<\/strong> controlla se la pagina corrente \u00e8 una categoria (\u00e8_categoria), Tag (\u00e8_tag), Autore o una pagina basata sulla data. La riga successiva usa <strong>the_excerpt()<\/strong> per visualizzare un breve estratto invece di <strong>the_content<\/strong><\/p>\n<p>Se vuoi mostrare un link alla fine dell&#8217;estratto, puoi modificare <strong>functions.php<\/strong> (preferibilmente in child-theme), aggiungere quanto segue alla fine del file:<\/p>\n<pre><code>\/\/ Remove the ... from excerpt and change the text\nfunction change_excerpt_more()\n{\n\u00a0 function new_excerpt_more($more)\n\u00a0 \u00a0 {\n\u00a0 \u00a0 \/\/ Use .read-more to style the link\n\u00a0 \u00a0 \u00a0 return '&lt;span class=\"continue-reading\"&gt; &lt;a href=\"'. get_permalink(). '\"&gt;Continue Reading \u00bb&lt;\/a&gt;&lt;\/span&gt;';\n\u00a0 \u00a0 }\n\u00a0 add_filter('excerpt_more', 'new_excerpt_more');\n}\nadd_action('after_setup_theme', 'change_excerpt_more');<\/code><\/pre>\n<p>Questa modifica non altera l&#8217;output nel feed. Per mostrare l&#8217;estratto nel feed, dovrai andare alle impostazioni di wordpress, leggere le impostazioni e impostare &quot;Per ogni articolo in un feed, mostra&quot; su &quot;Riepilogo&quot; anzich\u00e9 &quot;Testo completo&quot;. Tuttavia, ci\u00f2 influisce sui post in anche altre pagine (home, archivio).<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">Fonte di registrazione:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/helloacm.com\" class=\"external external_icon\">helloacm.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visualizzazione degli estratti nelle pagine Home, Ricerca, Tag e Archivio di WordPress<\/p>\n","protected":false},"author":1,"featured_media":223922,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[896,835,996,804,844,865],"tags":[1168],"class_list":["post-232594","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codice","category-guida-per-principianti","category-marketing-dei-contenuti","category-php-6","category-tutorial","category-wordpress-6","tag-affiai-it"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/posts\/232594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/comments?post=232594"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/posts\/232594\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/media\/223922"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/media?parent=232594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/categories?post=232594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/tags?post=232594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}