Vote for this blog. Thank you

agungprasetyo blog's

It's about technology and life experience

Memindah Nama Dan Lokasi Default Stylesheet WordPress

Secara default, lokasi stylesheet dari wordpress adalah http://nama-domain-anda/wp-content/themes/nama-themes/style.css, yang sebenarnya nama &  lokasi ini diganti ke nama lain dengan menggunakan fungsi add_filter di file functions.php.

Mengganti Nama Stylesheet

Jika ingin mengganti nama style.css dengan nama lain, pada file functions.php di theme anda masukkan script berikut:

add_filter('stylesheet_uri','wpi_stylesheet_uri',10,2);

/**
 * wpi_stylesheet_uri
 * overwrite default theme stylesheet uri
 * filter stylesheet_uri
 * @see get_stylesheet_uri()
 */
function wpi_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri){

    return $stylesheet_dir_uri.'/css/mytheme.css';
}

Mengganti Direktori Default Stylesheet

Jika anda hanya ingin merubah direktori default dari stylesheet anda, masukkan script berikut pada file functions.php.

add_filter('stylesheet_directory_uri','wpi_stylesheet_dir_uri',10,2);

/**
 * wpi_stylesheet_dir_uri
 * overwrite theme stylesheet directory uri
 * filter stylesheet_directory_uri
 * @see get_stylesheet_directory_uri()
 */
function wpi_stylesheet_dir_uri($stylesheet_dir_uri, $theme_name){

	$subdir = '/css';
	return $stylesheet_dir_uri.$subdir;

}

Jika tips dan trik ini bisa bermanfaat buat anda, silahkan berikan komentar di bawah. Terima kasih…

Sumber : http://code.google.com/p/wp-istalker/source/browse/branches/WordPress/2.7/1.6.2/lib/modules/filters.php#326

Previous

Menjalankan Android di Netbook Acer Aspire One A150

Next

Apa Itu Alexa ?

2 Comments

  1. Wohohoho… cara baru ini rupanya… coba dulu ya gan!!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by Lovecraft & Theme by Anders Norén

Policy Privacy | Disclaimer

Verified by MonsterInsights