Cara Membuat Breadcrumb Tanpa Plugins WordPress

Cara Membuat Breadcrumb Tanpa Plugins WordPress-Setelah sebelumnya saya membahas artikel Cara Membuat Breadcrumb di WordPress, kali ini saya ingin membuat tutorial yang sama yaitu Cara Membuat Breadcrumb Tanpa Plugins WordPress.

Perbedaanya adalah cara ini tanpa penggunaan plugin, karna saya dulu membahas artikel membuat Breadcrumb menggunakan plugin. Siapa tau diantara kalian ada yang ingin memasang Breadcrumb tanpa harus menginstal plugin.

Namun jika tidak ingin repot-repot memasang script Anda dapat menggunakan plugin dengan mengunjungi artikel sebelumnya disini. Sebelum membahas ke tahap inti sebaiknya Anda mengetahui terlebih dahulu apa itu Breadcrumb?

Breadcrumb adalah internal link yang terletak biasanya dibagian bawah judul postingan, fungsi untama memasang Breadcrumb adalah untuk memudahkan pengunjung melakukan navigasi. selain itu untuk membantu robot search engine mengenali struktur blog Anda. Susunan Breadcrumb biasanya seperti Home>Kategori>Judu Postingan.

Cara Membuat Breadcrumb Tanpa Plugins WordPress:

Langkah pertama membuat breadcrumb adalah, buka file Fungtions.php di template yang Anda gunakan. Kemudian  tambahkan script dibawah ini di Fungtions:

                </code><code class="php functions">echo</code> <code class="php string">'<ul id="crumbs">'</code><code class="php plain">;</code></div>
<div class="line number2 index1 alt1"><code class="php spaces">        </code><code class="php keyword">if</code><code class="php plain">(!is_home()) {</code></div>
<div class="line number3 index2 alt2"><code class="php spaces">                </code><code class="php functions">echo</code><code class="php string">'<li><a href="'</code><code class="php plain">;</code></div>
<div class="line number4 index3 alt1"><code class="php spaces">                </code><code class="php functions">echo</code><code class="php plain">get_option(</code><code class="php string">'home'</code><code class="php plain">);</code></div>
<div class="line number5 index4 alt2"><code class="php spaces">                </code><code class="php functions">echo</code><code class="php string">'">'</code><code class="php plain">;</code></div>
<div class="line number6 index5 alt1"><code class="php spaces">                </code><code class="php functions">echo</code><code class="php string">'Home'</code><code class="php plain">;</code></div>
<div class="line number7 index6 alt2"><code class="php spaces">                </code><code class="php functions">echo</code><code class="php string">"</a></li>"</code><code class="php plain">;</code></div>
<div class="line number8 index7 alt1"><code class="php spaces">                </code><code class="php keyword">if</code><code class="php plain">(is_category() || is_single()) {</code></div>
<div class="line number9 index8 alt2"><code class="php spaces">                        </code><code class="php functions">echo</code><code class="php string">'<li>'</code><code class="php plain">;</code></div>
<div class="line number10 index9 alt1"><code class="php spaces">                        </code><code class="php plain">the_category(</code><code class="php string">' </li><li> '</code><code class="php plain">);</code></div>
<div class="line number11 index10 alt2"><code class="php spaces">                        </code><code class="php keyword">if</code><code class="php plain">(is_single()) {</code></div>
<div class="line number12 index11 alt1"><code class="php spaces">                                </code><code class="php functions">echo</code><code class="php string">"</li><li>"</code><code class="php plain">;</code></div>
<div class="line number13 index12 alt2"><code class="php spaces">                                </code><code class="php plain">the_title();</code></div>
<div class="line number14 index13 alt1"><code class="php spaces">                                </code><code class="php functions">echo</code><code class="php string">'</li>'</code><code class="php plain">;</code></div>
<div class="line number15 index14 alt2"><code class="php spaces">                        </code><code class="php plain">}</code></div>
<div class="line number16 index15 alt1"><code class="php spaces">                </code><code class="php plain">} </code><code class="php keyword">elseif</code><code class="php plain">(is_page()) {</code></div>
<div class="line number17 index16 alt2"><code class="php spaces">                        </code><code class="php functions">echo</code><code class="php string">'<li>'</code><code class="php plain">;</code></div>
<div class="line number18 index17 alt1"><code class="php spaces">                        </code><code class="php functions">echo</code><code class="php plain">the_title();</code></div>
<div class="line number19 index18 alt2"><code class="php spaces">                        </code><code class="php functions">echo</code><code class="php string">'</li>'</code><code class="php plain">;</code></div>
<div class="line number20 index19 alt1"><code class="php spaces">                </code><code class="php plain">}</code></div>
<div class="line number21 index20 alt2"><code class="php spaces">        </code><code class="php plain">}</code></div>
<div class="line number22 index21 alt1"><code class="php spaces">        </code><code class="php keyword">elseif</code><code class="php plain">(is_tag()) {single_tag_title();}</code></div>
<div class="line number23 index22 alt2"><code class="php spaces">        </code><code class="php keyword">elseif</code><code class="php plain">(is_day()) {</code><code class="php functions">echo</code><code class="php string">"<li>Archive for "</code><code class="php plain">; the_time(</code><code class="php string">'F jS, Y'</code><code class="php plain">); </code><code class="php functions">echo</code><code class="php string">'</li>'</code><code class="php plain">;}</code></div>
<div class="line number24 index23 alt1"><code class="php spaces">        </code><code class="php keyword">elseif</code><code class="php plain">(is_month()) {</code><code class="php functions">echo</code><code class="php string">"<li>Archive for "</code><code class="php plain">; the_time(</code><code class="php string">'F, Y'</code><code class="php plain">); </code><code class="php functions">echo</code><code class="php string">'</li>'</code><code class="php plain">;}</code></div>
<div class="line number25 index24 alt2"><code class="php spaces">        </code><code class="php keyword">elseif</code><code class="php plain">(is_year()) {</code><code class="php functions">echo</code><code class="php string">"<li>Archive for "</code><code class="php plain">; the_time(</code><code class="php string">'Y'</code><code class="php plain">); </code><code class="php functions">echo</code><code class="php string">'</li>'</code><code class="php plain">;}</code></div>
<div class="line number26 index25 alt1"><code class="php spaces">        </code><code class="php keyword">elseif</code><code class="php plain">(is_author()) {</code><code class="php functions">echo</code><code class="php string">"<li>Author Archive"</code><code class="php plain">; </code><code class="php functions">echo</code><code class="php string">'</li>'</code><code class="php plain">;}</code></div>
<div class="line number27 index26 alt2"><code class="php spaces">        </code><code class="php keyword">elseif</code><code class="php plain">(isset(</code><code class="php variable">$_GET</code><code class="php plain">[</code><code class="php string">'paged'</code><code class="php plain">]) && !</code><code class="php functions">empty</code><code class="php plain">(</code><code class="php variable">$_GET</code><code class="php plain">[</code><code class="php string">'paged'</code><code class="php plain">])) {</code><code class="php functions">echo</code><code class="php string">"<li>Blog Archives"</code><code class="php plain">; </code><code class="php functions">echo</code><code class="php string">'</li>'</code><code class="php plain">;}</code></div>
<div class="line number28 index27 alt1"><code class="php spaces">        </code><code class="php keyword">elseif</code><code class="php plain">(is_search()) {</code><code class="php functions">echo</code><code class="php string">"<li>Search Results"</code><code class="php plain">; </code><code class="php functions">echo</code><code class="php string">'</li>'</code><code class="php plain">;}</code></div>
<div class="line number29 index28 alt2"><code class="php spaces">        </code><code class="php functions">echo</code><code class="php string">'</ul>'</code><code class="php plain">;</code></div>
<div class="line number30 index29 alt1"><code class="php plain">}

Setelah Anda selesai menambahkan script di atas langkah selanjutnya adalah memasang script dibawah ini, untuk pemasangan script Anda dapat memasang dimana saja yang Anda inginkan baik itu di single.php atau di header.php.
<?php the_breadcrumb(); ?>
Breadcrumb yang kita pasang ini tentunya akan menampilkan tampilan yang sederhana. Jika Anda ingin membeuat Breadcrumb yang lebih menarik dapat menambahkan code CSS. Saya kira untuk artikel kali ini cukup sekian dan jika artikel ini bermanfaat silahkan follow facebook dan twitter kami atau klik share dengan menekan tombol dibawah ini untuk memberitahukan kepada teman-teman Anda di social media. Terima kasih
Baca Juga Cara Membuat toko online dengan mudah | CARA DAN KUMPULAN KERAJINAN UNIK DAN KEREN

Leave a Reply

Your email address will not be published. Required fields are marked *

Read previous post:
Cara Hapus Default Gambar Link WordPress Secara Otomatis

Cara Hapus Default Gambar Link WordPress Secara Otomatis-Banyak kemudahan yang...

Close