Berikut ini adalah cara menambahkan meta tag deskripsi kedalam halaman custom smart toko seperti :
– Cart
– Cek-ongkir
– Konfirmasi
– Katalog
Tambahkan kode di bawah ini ke functions.php di folder smart toko
function insert_meta_desk_smarttoko() { global $wp_query; if ( !$wp_query->get('shop')) //if it is not a post or a page return; if($wp_query->get('shop') == 'cart') $desk = 'Keranjang belanja Smart Toko'; if($wp_query->get('shop') == 'cek-ongkir') $desk = 'Cek Ongkir Smart Toko'; if($wp_query->get('shop') == 'konfirmasi') $desk = 'Halaman Konfirmasi belanja Smart Toko'; if($wp_query->get('shop') == 'katalog') $desk = 'Halaman Katalog belanja Smart Toko'; echo '<meta name="description" content="'.$desk.'">'; } add_action( 'wp_head', 'insert_meta_desk_smarttoko', 5 ); function wp_smart_toko_cust_title() { global $wp_query; if( $wp_query->get('shop') ){ //$titles = 'Cart | '.get_bloginfo('name'); if($wp_query->get('shop') == 'cart') $title = 'Cart | '.get_bloginfo('name'); if($wp_query->get('shop') == 'cek-ongkir') $title = 'Cek Ongkir | '.get_bloginfo('name'); if($wp_query->get('shop') == 'katalog') $title = 'Katalog | '.get_bloginfo('name'); if($wp_query->get('shop') == 'konfirmasi') $title = 'Konfirmasi | '.get_bloginfo('name'); return $title; } } add_filter('wp_title', wp_smart_toko_cust_title, 100);
meta deskripsi & title akan otomatis berubah jika meng akses beberapa halaman di atas
0 Comments