{"id":9069,"date":"2025-12-02T04:06:15","date_gmt":"2025-12-02T04:06:15","guid":{"rendered":"https:\/\/cachsudung.com\/?p=9069"},"modified":"2025-12-02T04:06:15","modified_gmt":"2025-12-02T04:06:15","slug":"code-bai-viet-lien-quan-dep-cho-flatsome","status":"publish","type":"post","link":"https:\/\/how.congdongso.net\/en\/nice-related-article-code-for-flatsome\/","title":{"rendered":"Share beautiful related article code for Flatsome"},"content":{"rendered":"<p><a href=\"https:\/\/how.congdongso.net\/chia-se-code-bai\u2026dep-cho-flatsome\/\"><strong>Share beautiful related article code for Flatsome<\/strong><\/a>.When you write an article, there will often be related topics associated with that category. Then your article will forever stay on your website and no one will know about it.<\/p>\n<p>To make your SEO content better. The code below will help you display all related articles in the same category to help your articles reach better. Thereby also helping users experience your website for the longest time. That&#039;s the SEO trick. Now I will <a href=\"https:\/\/how.congdongso.net\/chia-se-code-bai\u2026dep-cho-flatsome\/\"><strong>Share beautiful related article code for Flatsome<\/strong><\/a> Comes with detailed instructions for you to follow.<\/p>\n<p><strong>Note:<\/strong> This code can only be used for the Flatsome theme and cannot be used for other themes to avoid copying it to another theme and then not being able to use it.<\/p>\n<p><strong>see more <\/strong><\/p>\n<ul>\n<li><strong><a href=\"https:\/\/how.congdongso.net\/code-thu-gon-noi-dung\/\" target=\"_blank\" rel=\"noopener\">The code condenses product details and categories on Flatsome<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/how.congdongso.net\/code-hien-thi-khuyen-mai-dep-cho-flatsome\/\" target=\"_blank\" rel=\"noopener\">The code shows nice promotions for flatsome like Cellphones<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/how.congdongso.net\/code-hien-thi-hotline-tren-website\/\" target=\"_blank\" rel=\"noopener\">Code to display hotline on website<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/how.congdongso.net\/code-tu-dong-luu-anh-vao-hot\" target=\"_blank\" rel=\"noopener\">Code to automatically save images to hot when copying images from other pages<\/a><\/strong><\/li>\n<\/ul>\n<h2>How to insert beautiful related article code for Flatsome<\/h2>\n<h3><strong>Step 1:<\/strong> Login hoting<\/h3>\n<figure id=\"attachment_9222\" aria-describedby=\"caption-attachment-9222\" style=\"width: 950px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-9222\" src=\"https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome.jpg\" alt=\"Share beautiful related article code for Flatsome\" width=\"960\" height=\"636\" title=\"\" srcset=\"https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome.jpg 960w, https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-300x199.jpg 300w, https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-768x509.jpg 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption id=\"caption-attachment-9222\" class=\"wp-caption-text\">Share related article code for Flatsome<\/figcaption><\/figure>\n<p>You need to log in to the hotline where you rented the server &gt; <strong>File<\/strong> &gt; <strong>Find your website<\/strong> &gt; Create <strong>1 files<\/strong> in hosting with name <strong>Single.php<\/strong><\/p>\n<h3><strong>Step 2<\/strong>: Copy the Code <strong>Single.php<\/strong><\/h3>\n<p>After creating, you need to copy the entire code below inside the file <strong>Single.php<\/strong><\/p>\n<pre>&lt;?php\r\nget_header();\r\n?&gt;\r\n&lt;div id=&quot;content&quot; class=&quot;blog-wrapper blog-single page-wrapper&quot;&gt;\r\n&lt;?php get_template_part( &#039;template-parts\/posts\/layout&#039;, get_theme_mod(&#039;blog_post_layout&#039;,&#039;right-sidebar&#039;) ); ?&gt;\r\n&lt;div class=&quot;row row-large&quot;&gt;\r\n&lt;div class=&quot;large-9 col&quot;&gt;\r\n&lt;div class=&quot;danh-muc&quot;&gt;&lt;span class=&quot;titles&quot;&gt;Category: &lt;\/span&gt;&lt;?php\r\n$category_list = get_the_category_list( __( &#039; &#039;, &#039;flatsome&#039; ) );\r\nprintf($category_list, the_title_attribute( &#039;echo=0&#039; ) );?&gt;&lt;\/div&gt;\r\n&lt;div class=&quot;the-tim-kiem&quot;&gt;&lt;span class=&quot;titles&quot;&gt;Key word:&lt;\/span&gt;&lt;?php echo get_the_tag_list(&#039;&amp;nbsp;&#039;,&#039; &#039;,&#039;&#039;); ?&gt;&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;div id=&quot;secrelatedcat&quot; class=&quot;sec-relatedcat&quot;&gt;\r\n&lt;div class=&quot;row row-large&quot;&gt;\r\n&lt;div class=&quot;large-12 col&quot;&gt;\r\n&lt;?php\r\n$categories = get_the_category(get_the_ID());\r\nif ($categories){\r\necho &#039;&lt;div class=&quot;relatedcat&quot;&gt;&#039;;\r\n$category_ids = array();\r\nforeach($categories as $individual_category) $category_ids[] = $individual_category-&gt;term_id;\r\n$args=array(\r\n&#039;category__in&#039; =&gt; $category_ids,\r\n&#039;post__not_in&#039; =&gt; array(get_the_ID()),\r\n&#039;posts_per_page&#039; =&gt; 8, \/\/ So bai viet dc hien thi\r\n);\r\n$my_query = new wp_query($args);\r\nif( $my_query-&gt;have_posts() ):\r\necho &#039;&lt;h3 class=&quot;relatedcat__title&quot;&gt;&lt;span&gt;B&agrave;i vi\u1ebft li&ecirc;n quan&lt;\/span&gt;&lt;\/h3&gt;&lt;ul&gt;&#039;;\r\nwhile ($my_query-&gt;have_posts()):$my_query-&gt;the_post();\r\n?&gt;\r\n&lt;li&gt;\r\n&lt;div class=&quot;relatedcat-thumnail&quot;&gt;\r\n&lt;a href=&quot;&lt;?php%20the_permalink()%20?&gt;&quot;&gt;\r\n&lt;?php the_post_thumbnail(); ?&gt;\r\n&lt;\/a&gt;\r\n&lt;\/div&gt;\r\n&lt;a href=&quot;&lt;?php%20the_permalink()%20?&gt;&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;?php\r\nendwhile;\r\necho &#039;&lt;\/ul&gt;&#039;;\r\nendif; wp_reset_query();\r\necho &#039;&lt;\/div&gt;&#039;;}?&gt;\r\n&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;?php get_footer();<\/pre>\n<h3><strong>Step 3:<\/strong> CSS makes it more beautiful<\/h3>\n<p>To make your related posts display better, you need to css it so your display will look better.<\/p>\n<p>You need to copy it into your CSS section by following the following link. <strong>Display<\/strong> &gt; <strong>Theme file editor<\/strong> &gt; <strong>Style.css<\/strong><\/p>\n<figure id=\"attachment_9223\" aria-describedby=\"caption-attachment-9223\" style=\"width: 950px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-9223\" src=\"https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-1.jpg\" alt=\"Share beautiful related article code for Flatsome\" width=\"960\" height=\"444\" title=\"\" srcset=\"https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-1.jpg 960w, https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-1-300x139.jpg 300w, https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-1-768x355.jpg 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption id=\"caption-attachment-9223\" class=\"wp-caption-text\">Nice related article code for Flatsome<\/figcaption><\/figure>\n<pre>\/* Related article css Author: hocdohoacaptoc.com *\/ .blog-wrapper.blog-single .container.section-title-container .section-title.section-title-center { justify-content: center;} .blog -wrapper.blog-single .container.section-title-container .section-title.section-title-center b { display: none;} .single-post .entry-header-text { margin-top: 0 !important; } .by-wpdiscuz { display: none;} .post-views.post-12886.entry-meta { padding-bottom: 0;} .entry-meta__entry-review { display: flex; align-items: center;} span.post-views-icon.dashicons.dashicons-chart-bar { display: none !important;} span.a_posted-on.posted-views { display: flex;} span.a_byline { color : #999; margin-bottom: 0; line-height: 23px; font-size: 14px; margin-right: 0; letter-spacing: 0;} .archive .hide-archive { display: none !important;} .relatedcat ul &gt; li &gt; a { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; height: 40px;} .relatedcat { border: none !important;} .sec-relatedcat { background-color: #f5f5f5;} .blog-wrapper.blog-single.page-wrapper { padding-bottom: 0;} .relatedcat{ border:2px dashed red; padding:5px; margin-top:10px; margin-bottom:10px; overflow:hidden} .recent-blog-posts a{ font-size:14px} .relatedcat h3{ color:red; font-style:italic} .relatedcat li a{ color:#242424} .relatedcat li{ padding-left:10px; margin-left:0} .relatedcat li a:hover{ color:Blue} .relatedcat li i,.relatedcat h3 i{ padding-right:5px} #theh1 { display: none;} @media (min-width: 849px) { .relatedcat ul { overflow: hidden; margin: 0 -10px;} .relatedcat ul &gt; li { list-style: none; width: 25%; padding: 8px 10px; float: left; margin-bottom: 20px;} .relatedcat ul &gt; li img { object-fit: cover; width: 100%; height: 175px; border-radius: 5px; transition: transform .5s;} .relatedcat ul &gt; li &gt; a { line-height: 20px; display: block; margin-top: 10px;}} \/* Running out of related article CSS *\/<\/pre>\n<h3><strong>Step 4:<\/strong> Check the results again.<\/h3>\n<p>After you add correctly, we will have a section displaying related articles like the image below.<\/p>\n<figure id=\"attachment_9224\" aria-describedby=\"caption-attachment-9224\" style=\"width: 950px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-9224\" src=\"https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-2.jpg\" alt=\"Share beautiful related article code for Flatsome\" width=\"960\" height=\"402\" title=\"\" srcset=\"https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-2.jpg 960w, https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-2-300x126.jpg 300w, https:\/\/how.congdongso.net\/wp-content\/uploads\/2024\/01\/chia-se-code-bai-viet-lien-quan-dep-cho-flatsome-2-768x322.jpg 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption id=\"caption-attachment-9224\" class=\"wp-caption-text\">Nice related article code for Flatsome<\/figcaption><\/figure>\n<h2>Conclude<\/h2>\n<p>So I just shared it <strong>Nice related article code for Flatsome<\/strong> beautiful for you. Hopefully this code will help make your article more lively. Through this, your articles will also become richer.<\/p>\n<p>Don&#039;t forget to follow <a href=\"https:\/\/fb.com\/howto.edu.vn\" target=\"_blank\" rel=\"noopener\"><strong>us on facebook<\/strong><\/a> to be updated with the latest information<\/p>","protected":false},"excerpt":{"rendered":"<p>Chia s\u1ebb code b\u00e0i vi\u1ebft li\u00ean quan \u0111\u1eb9p cho Flatsome.Khi b\u1ea1n vi\u1ebft 1 b\u00e0i vi\u1ebft th\u00ec s\u1ebd th\u01b0\u1eddng c\u00f3 c\u00e1c ch\u1ee7 \u0111\u1ec1 li\u00ean quan \u0111i k\u00e8m v\u1edbi chuy\u00ean m\u1ee5c \u0111\u00f3. Khi \u0111\u00f3 n\u1ebfu b\u00e0i vi\u1ebft c\u1ee7a b\u1ea1n s\u1ebd m\u00e3i n\u1eb1m trong web c\u1ee7a b\u1ea1n v\u00e0 kh\u00f4ng ai bi\u1ebft t\u1edbi. \u0110\u1ec3 n\u1ed9i dung Seo c\u1ee7a b\u1ea1n &hellip;<\/p>","protected":false},"author":2,"featured_media":19602,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1190],"tags":[173,175,176,261],"class_list":["post-9069","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-flatsome","tag-code-bai-viet-lien-quan","tag-code-flatsome","tag-code-hay","tag-flatsome"],"_links":{"self":[{"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/posts\/9069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/comments?post=9069"}],"version-history":[{"count":1,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/posts\/9069\/revisions"}],"predecessor-version":[{"id":21405,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/posts\/9069\/revisions\/21405"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/media\/19602"}],"wp:attachment":[{"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/media?parent=9069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/categories?post=9069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/how.congdongso.net\/en\/wp-json\/wp\/v2\/tags?post=9069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}