{"id":232760,"date":"2023-01-28T18:17:00","date_gmt":"2023-01-28T15:17:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=232760"},"modified":"2023-01-28T18:18:33","modified_gmt":"2023-01-28T15:18:33","slug":"kuinka-naeyttaeae-historiallisen-taenaeaen-viestit-wordpressissae","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/fi\/kuinka-naeyttaeae-historiallisen-taenaeaen-viestit-wordpressissae\/","title":{"rendered":"Kuinka n\u00e4ytt\u00e4\u00e4 historiallisen &#8221;t\u00e4n\u00e4\u00e4n&#8221; viestit WordPressiss\u00e4?"},"content":{"rendered":"<p>Voit n\u00e4ytt\u00e4\u00e4 aiheeseen liittyvi\u00e4 viestej\u00e4 (k\u00e4ytt\u00e4en tunnisteita, luokkia tai muita avainsanoja) saadaksesi lis\u00e4\u00e4 sivun katselukertoja. Vaihtoehtoisesti voit n\u00e4ytt\u00e4\u00e4 t\u00e4m\u00e4n p\u00e4iv\u00e4n historialliset viestit menneisyydess\u00e4 viestin sis\u00e4ll\u00f6n lopussa. <strong>Kopioi seuraava PHP &#8211; koodi ja laita se wordpress &#8211; funktiomallin functions.php<\/strong> loppuun, mieluiten <a href=\"https:\/\/wordpress.mediadoma.com\/fi\/wordpress-child-theme-ainoat-asiat-jotka-sinun-tarvitsee-tietaeae\/\" title=\"lapsiteemalla\">lapsiteemalla<\/a>.<\/p>\n<pre><code>function today_in_histroy(){\n\u00a0 \u00a0 $today = getdate();\n\u00a0 \u00a0 $args = array(\n\u00a0 \u00a0 \u00a0 \u00a0 'date_query' =&gt; array(\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 array(\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 'year' \u00a0 \u00a0 \u00a0=&gt; $today['year'],\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 'compare' \u00a0 =&gt; '!=',\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ),\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 array(\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 'month' =&gt; $today['mon'],\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 'day' \u00a0 =&gt; $today['mday'],\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ),\n\u00a0 \u00a0 \u00a0 \u00a0 ),\n\u00a0 \u00a0 );\n\u00a0 \u00a0 $postlist = get_posts($args);\n\u00a0 \u00a0 $html = '&lt;h3 class=\"tih-title\"&gt;Posts of Historic Today&lt;\/h3&gt;&lt;ul class=\"tih-title-list\"&gt;';\n\u00a0 \u00a0 if(!empty($postlist)){\n\u00a0 \u00a0 \u00a0 \u00a0 foreach ($postlist as $key =&gt; $post) {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 $html .= '&lt;li class=\"tih-title-item\"&gt;&lt;a href=\"'. get_permalink($post-&gt;ID). '\" title=\"'. $post-&gt;post_title. '\"&gt;'. $post-&gt;post_title. '&lt;\/a&gt;&lt;\/li&gt;';\n\u00a0 \u00a0 \u00a0 \u00a0 }\n\u00a0 \u00a0 \u00a0 \u00a0 $html .= '&lt;\/ul&gt;';\n\u00a0 \u00a0 \u00a0 \u00a0 return $html;\n\u00a0 \u00a0 }\n\u00a0 \u00a0 return \"\";\n}\n\u00a0\nfunction add_today_in_histroy($content){\n\u00a0 \u00a0 global $post;\n\u00a0 \u00a0 return \u00a0$content. today_in_histroy(); \n}\nadd_filter('the_content','add_today_in_histroy');<\/code><\/pre>\n<p>Ajatuksena on tehd\u00e4 kysely, joka etsii viestej\u00e4 ja k\u00e4ytt\u00e4\u00e4 <strong>add_filter -toimintoa<\/strong> lis\u00e4t\u00e4ksesi <strong>sis\u00e4lt\u00f6\u00f6n<\/strong>.<\/p>\n<p>wordpress<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/helloacm.com\" class=\"external external_icon\">helloacm.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kuinka n\u00e4ytt\u00e4\u00e4 historiallisen &#8221;t\u00e4np\u00e4iv\u00e4n&#8221; viestit WordPressiss\u00e4?<\/p>\n","protected":false},"author":1,"featured_media":221210,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[895,917,834,843,803,995,864],"tags":[1166],"class_list":["post-232760","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-koodi","category-muut","category-opas-aloittelijoille","category-opetusohjelmia","category-php-5","category-sisaltomarkkinointi","category-wordpress-5","tag-affiai-fi"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/posts\/232760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/comments?post=232760"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/posts\/232760\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/media\/221210"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/media?parent=232760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/categories?post=232760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/fi\/wp-json\/wp\/v2\/tags?post=232760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}