Sabtu, 23 Maret 2013

Wordpress Plugin Path and Dir

http://codex.wordpress.org/Function_Reference/plugin_dir_path

Function Reference/plugin dir path


Contents

[hide]

Description

Gets the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in

Usage

<?php plugin_dir_path$file ); ?>

Parameters

$file
(string) (required) The filename of the plugin (__FILE__)
Default: None

Examples

Defining a constant to include files in a plugin, with the correct path
<?php
define( 'MYPLUGINNAME_PATH', plugin_dir_path(__FILE__) );
require MYPLUGINNAME_PATH . 'includes/class-metabox.php';
require MYPLUGINNAME_PATH . 'includes/class-widget.php';
?>
                        

Return Values

(string) 
the filesystem path of the directory that contains the plugin

Change Log

Since: 2.8

Source File

plugin_dir_path() is located in wp-includes/plugin.php

Related

This can be fairly reliably used to find the local path to the plugins directory by using a string manipulation to remove just the base directory of the plugin (equivalent to the non-existent plugins_dir_path()).
plugins_url(), plugin_dir_url(), plugin_dir_path()

Foto Propades