<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP Engineer &#187; WordPress Plugins</title>
	<atom:link href="http://wpengineer.com/tag/wordpress-plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com</link>
	<description>WordPress News, Hacks, Tips, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Mon, 21 May 2012 22:48:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WP_List_Table &#8211; a step by step guide</title>
		<link>http://wpengineer.com/2426/wp_list_table-a-step-by-step-guide/</link>
		<comments>http://wpengineer.com/2426/wp_list_table-a-step-by-step-guide/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 08:47:32 +0000</pubDate>
		<dc:creator>Latz</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2426</guid>
		<description><![CDATA[Throughout WordPress the class WP_List_Table is used to display data, e.g. users, plugins, comments, or posts. The class contains almost all necessary methods for displaying, sorting, paginating, and searching data and and what is more obvious than to use it for your own plugins? This article tries to give you a comprehensive walk-through all necessary [...]]]></description>
			<content:encoded><![CDATA[<p>Throughout WordPress the class <code>WP_List_Table</code> is used to display data, e.g. users, plugins, comments, or posts. The class contains almost all necessary methods for displaying, sorting, paginating, and searching data and and what is more obvious than to use it for your own plugins?</p>
<p>This article tries to give you a comprehensive walk-through all necessary steps to create a table tailored to your needs.</p>
<ol>
<li><a href="#preliminary">Preliminary work</a></li>
<li><a href="#basics">Basics</a></li>
<li><a href="#sorting">Sorting</a></li>
<li><a href="#actions">Actions</a></li>
<li><a href="#bulk">Bulk actions</a></li>
<li><a href="#pagination">Pagination</a></li>
<li><a href="#searching">Searching</a></li>
<li><a href="#screen-options">Screen options</a></li>
<li><a href="#styling">Styling the table</a></li>
<li><a href="#other">Other customizations</a></li>
<li><a href="#links">Weblinks</a></li>
</ol>
<h3 id="preliminary">Preliminary work</h3>
<p>For testing purposes we create a small plugin which adds a menu item:</p>
<pre lang="php">
&lt;?php
/*
Plugin Name: My List Table Example
*/
?&gt;
&lt;div class=&quot;wrap&quot;&gt;
&lt;div id=&quot;icon-users&quot; class=&quot;icon32&quot;&gt;&lt;/div&gt;
&lt;h2&gt;My List Table Test/h2&gt;
&lt;/div&gt;
&lt;?php
</pre>
<h3 id="basics">Basics</h3>
<p>For a start we're creating a list table with only the basic functionality. First we have to make sure that the necessary class is available since the <code>WP_List_Table</code> isn't loaded automatically:</p>
<pre class="brush: php">if( ! class_exists( &#039;WP_List_Table&#039; ) ) {
    require_once( ABSPATH . &#039;wp-admin/includes/class-wp-list-table.php&#039; );
}</pre>
<p>To create a table to your needs you have to derive a class from <code>WP_List_Table</code>:</p>
<pre lang="PHP">class My_List_Table extends WP_List_Table {
}

$myListTable = new My__List_Table();</pre>
<p>For demonstration purposes we create some sample data. Usually this data would be read from the database:</p>
<pre lang="PHP">var $example_data = array(
  array(&#039;ID&#039; =&gt; 1,&#039;booktitle&#039; =&gt; &#039;Quarter Share&#039;, &#039;author&#039; =&gt; &#039;Nathan Lowell&#039;,
        &#039;isbn&#039; =&gt; &#039;978-0982514542&#039;),
  array(&#039;ID&#039; =&gt; 2, &#039;booktitle&#039; =&gt; &#039;7th Son: Descent&#039;,&#039;author&#039; =&gt; &#039;J. C. Hutchins&#039;,
        &#039;isbn&#039; =&gt; &#039;0312384378&#039;),
  array(&#039;ID&#039; =&gt; 3, &#039;booktitle&#039; =&gt; &#039;Shadowmagic&#039;, &#039;author&#039; =&gt; &#039;John Lenahan&#039;,
        &#039;isbn&#039; =&gt; &#039;978-1905548927&#039;),
  array(&#039;ID&#039; =&gt; 4, &#039;booktitle&#039; =&gt; &#039;The Crown Conspiracy&#039;, &#039;author&#039; =&gt; &#039;Michael J. Sullivan&#039;,
        &#039;isbn&#039; =&gt; &#039;978-0979621130&#039;),
  array(&#039;ID&#039; =&gt; 5, &#039;booktitle&#039;     =&gt; &#039;Max Quick: The Pocket and the Pendant&#039;, &#039;author&#039;    =&gt; &#039;Mark Jeffrey&#039;,
        &#039;isbn&#039; =&gt; &#039;978-0061988929&#039;),
  array(&#039;ID&#039; =&gt; 6, &#039;booktitle&#039; =&gt; &#039;Jack Wakes Up: A Novel&#039;, &#039;author&#039; =&gt; &#039;Seth Harwood&#039;,
        &#039;isbn&#039; =&gt; &#039;978-0307454355&#039;)
);</pre>
<p>Before we can display the data in the table we have to define some methods and variables:</p>
<pre lang="PHP">
function get_columns(){
  $columns = array(
    &#039;booktitle&#039; =&gt; &#039;Title&#039;,
    &#039;author&#039;    =&gt; &#039;Author&#039;,
    &#039;isbn&#039;      =&gt; &#039;ISBN&#039;
  );
  return $columns;
}

function prepare_items() {
  $columns = $this-&gt;get_columns();
  $hidden = array();
  $sortable = array();
  $this-&gt;_column_headers = array($columns, $hidden, $sortable);
  $this-&gt;items = $this-&gt;example_data;;
}</pre>
<p>The method <code>get_columns()</code> is needed to label the columns on the top and bottom of the table. The keys in the array have to be the same as in the data array otherwise the respective columns aren't displayed.</p>
<p><code>prepare_items</code> defines two arrays controlling the behaviour of the table:</p>
<ul>
<li>$hidden defines the hidden columns (see <a href="#screen-options">Screen Options</a>),</li>
<li>$sortable defines if the table can be sorted by this column.</li>
</ul>
<p>Finally the method assigns the example data to the class' data representation variable <code>items</code>.</p>
<p>Before actually displaying each column WordPress looks for methods called <code>column_{key_name}</code>, e.g. <code>function column_booktitle</code>. There has to be such a method for every defined column. To avoid the need to create a method for each column there is <code>column_default</code> that will process any column for which no special method is defined:</p>
<pre lang="php">
function column_default( $item, $column_name ) {
  switch( $column_name ) {
    case &#039;booktitle&#039;:
    case &#039;author&#039;:
    case &#039;isbn&#039;:
      return $item&#091; $column_name &#093;;
    default:
      return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
  }
}
</pre>
<p>In our example the method will return the title for every column and if the column is not found it displays the content of the $item array for debugging purposes.</p>
<p>These are the essential ingredients to define a custom list table class. All you have to do now is to add an admin page to the backend, create an instance of our class, prepare the items and call <code>display()</code> to actually display the table:</p>
<pre class="brush: php">
function my_add_menu_items(){
    add_menu_page( &#039;My Plugin List Table&#039;, &#039;My List Table Example&#039;, &#039;activate_plugins&#039;, &#039;my_list_test&#039;, &#039;my_render_list_page&#039; );
}
add_action( &#039;admin_menu&#039;, &#039;my_add_menu_items&#039; );

function my_render_list_page(){
  $myListTable = new My_Example_List_Table();
  echo &#039;&lt;div class=&quot;wrap&quot;&gt;&lt;h2&gt;My List Table Test&lt;/h2&gt;&#039;;
  $myListTable-&gt;prepare_items();
  $myListTable-&gt;display();
  echo &#039;&lt;/div&gt;&#039;;
}
</pre>
<p>This is the minimal version of a WP_List_Table possible:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/21-03-2012-13-23-07.png" alt="" title="Minimal WP_List_Table" width="646" height="276" class="aligncenter size-full wp-image-2427" /><br />
<a href="https://gist.github.com/gists/2147390/download">Download minimal WP_List_Table example</a> (gist)</p>
<h3 id="sorting">Sorting</h3>
<p>At the moment the items appear in the order they are defined in the code since the WP_List_Table class does not contain any code for sorting. What it does contain is some code to mark certain columns as sortable. In section "Basics" there already was a line <code>$sortable = array();</code> which now will be changed to:</p>
<pre lang="PHP">$sortable = $this-&gt;get_sortable_columns();</pre>
<p>Additionally we need the method:</p>
<pre lang="PHP">function get_sortable_columns() {
  $sortable_columns = array(
    &#039;booktitle&#039;  =&gt; array(&#039;booktitle&#039;,false),
    &#039;author&#039; =&gt; array(&#039;author&#039;,false),
    &#039;isbn&#039;   =&gt; array(&#039;isbn&#039;,false)
  );
  return $sortable_columns;
}</pre>
<p>This way the above mentioned column headers are changed to links and display small triangles if the mouse hovers over them. The second parameter in the value array of <code>$sortable_columns</code> takes care of a possible pre-ordered column. If the value is <code>true</code> the column is assumed to be ordered ascending, if the value is <code>false</code> the column is assumed descending or unordered. This is needed for the small triangle beside the column name indicating the sort order to show in the correct direction:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/22.02.014.png" alt="" title="Sorting" width="450" height="78" class="aligncenter size-full wp-image-2428" /></p>
<p>If you click on the column header the page is reloaded and <code>$_GET</code> contains something like this:</p>
<pre lang="PHP">array
  &#039;page&#039; =&gt; string &#039;my_list_test&#039; (length=12)
  &#039;orderby&#039; =&gt; string &#039;booktitle&#039; (length=5)
  &#039;order&#039; =&gt; string &#039;asc&#039; (length=3)</pre>
<p>With this information you can write a method for sorting our example data:</p>
<pre lang="PHP">function usort_reorder( $a, $b ) {
  // If no sort, default to title
  $orderby = ( ! empty( $_GET&#091;&#039;orderby&#039;&#093; ) ) ? $_GET&#091;&#039;orderby&#039;&#093; : &#039;booktitle&#039;;
  // If no order, default to asc
  $order = ( ! empty($_GET&#091;&#039;order&#039;&#093; ) ) ? $_GET&#091;&#039;order&#039;&#093; : &#039;asc&#039;;
  // Determine sort order
  $result = strcmp( $a&#091;$orderby&#093;, $b&#091;$orderby&#093; );
  // Send final sort direction to usort
  return ( $order === &#039;asc&#039; ) ? $result : -$result;
}</pre>
<p>To actually sort the data we have to extend <code>prepare_items()</code>:</p>
<pre lang="PHP">function prepare_items() {
  &#091;..&#093;
  usort( $this-&gt;example_data, array( &amp;$this, &#039;usort_reorder&#039; ) );
  $this-&gt;items = $this-&gt;example_data;
}</pre>
<p>If you're retrieving the data from the database (which is most likely) it's of course best to use SQL's <code>ORDERBY</code> directly.</p>
<h3 id="actions">Actions</h3>
<p>If you not only want to display the items but also want to manipulate them you have to define some actions:
<pre lang="PHP">
function column_booktitle($item) {
  $actions = array(
            &#039;edit&#039;      =&gt; sprintf(&#039;&lt;a href=&quot;?page=%s&amp;action=%s&amp;book=%s&quot;&gt;Edit&lt;/a&gt;&#039;,$_REQUEST&#091;&#039;page&#039;&#093;,&#039;edit&#039;,$item&#091;&#039;ID&#039;&#093;),
            &#039;delete&#039;    =&gt; sprintf(&#039;&lt;a href=&quot;?page=%s&amp;action=%s&amp;book=%s&quot;&gt;Delete&lt;/a&gt;&#039;,$_REQUEST&#091;&#039;page&#039;&#093;,&#039;delete&#039;,$item&#091;&#039;ID&#039;&#093;),
        );

  return sprintf(&#039;%1$s %2$s&#039;, $item&#091;&#039;booktitle&#039;&#093;, $this-&gt;row_actions($actions) );
}
</pre>
<p>These actions will appear if the user hovers the mouse cursor over the table:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/actions4.png" alt="" title="Actions" width="427" height="126" class="aligncenter size-full wp-image-2429" /></p>
<p>If you click on one of the action links the form will return for example the following data in <code>$_GET</code>:</p>
<pre lang="PHP">array
  &#039;page&#039; =&gt; string &#039;my_list_test&#039; (length=12)
  &#039;action&#039; =&gt; string &#039;delete&#039; (length=6)
  &#039;book&#039; =&gt; string &#039;2&#039; (length=1)</pre>
<h3 id="bulk">Bulk actions</h3>
<p>Bulk action are implemented by overwriting the method <code>get_bulk_actions()</code> and returning an associated array:</p>
<pre lang="PHP">function get_bulk_actions() {
  $actions = array(
    &#039;delete&#039;    =&gt; &#039;Delete&#039;
  );
  return $actions;
}</pre>
<p>This only puts the dropdown menu and the apply button above and below the table:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/21-03-2012-17-08-00.png" alt="" title="21-03-2012 17-08-00" width="477" height="219" class="aligncenter size-full wp-image-2436" /></p>
<p>The checkboxes for the rows have to be defined separately. As mentioned above there is a method column_{column} for rendering a column. The <code>cb</code>-column is a special case:</p>
<pre lang="PHP">
function column_cb($item) {
        return sprintf(
            &#039;&lt;input type=&quot;checkbox&quot; name=&quot;book&#091;&#093;&quot; value=&quot;%s&quot; /&gt;&#039;, $item&#091;&#039;ID&#039;&#093;
        );
    }
</pre>
<p>This method currently will not be processed because we have to tell the class about the new column by extending the method <code>get_columns()</code>:</p>
<pre lang="php">
function get_columns() {
  $columns = array(
    &#039;cb&#039;        =&gt; &#039;&lt;input type=&quot;checkbox&quot; /&gt;&#039;,
&#091;..&#093;
}
</pre>
<p>This will also put the "select all" checkbox in the title bar:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/21-03-2012-17-14-30.png" alt="" title="Bulk 1" width="491" height="236" class="aligncenter size-full wp-image-2430" /></p>
<p>If you don't want to display the checkbox in the title you simply set the value to an empty string. Nevertheless you still have to define the key/value pair otherwise no checkboxes are shown at all:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/22-03-2012-15-11-51.png" alt="" title="22-03-2012 15-11-51" width="503" height="233" class="aligncenter size-full wp-image-2438" /></p>
<p>If "Apply" is pressed the form will return various variables: <code>action</code> and <code>action2</code> contain the selected action or <code>-1</code> if the user chose no action, and if any checkbox was selected the marked rows, in our case <code>books</code>, for example:</p>
<pre class="brush: php">
&#039;action&#039; =&gt; string &#039;delete&#039; (length=6)
&#039;book&#039; =&gt;
  array
    0 =&gt; string &#039;2&#039; (length=1)
    1 =&gt; string &#039;6&#039; (length=1)
&#039;action2&#039; =&gt; string &#039;-1&#039; (length=2)
</pre>
<p><code>action</code> contains the selection from the upper select box, <code>action2</code> the selection from the lower select box, and <code>book</code> the id of the selected rows, if any. You can  use the method <code>current_action()</code> to query <code>action/action2</code>:</p>
<pre lang="php">
$action = $this-&gt;current_action();
</pre>
<p>It will return <code>action</code> if it's set, otherwise <code>action2</code>. If nothing is set the method returns <code>FALSE</code>.</p>
<h3 id="pagination">Pagination</h3>
<p>First things first: WordPress does not paginate your data in any way. It only contains a method to display a navigation bar on the top and bottom right of the table:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/21-03-2012-17-38-38.png" alt="" title="Pagination" width="392" height="206" class="aligncenter size-full wp-image-2432" /></p>
<p>You have to tell the method how many items you have in total, how many items shall be displayed on a page, and most important, the data to be displayed on the page:</p>
<pre lang="PHP">function prepare_items() {
  &#091;...&#093;
  $per_page = 5;
  $current_page = $this-&gt;get_pagenum();
  $total_items = count($this-&gt;example_data);

  // only ncessary because we have sample data
  $this-&gt;found_data = array_slice($this-&gt;example_data,(($current_page-1)*$per_page),$per_page);

  $this-&gt;set_pagination_args( array(
    &#039;total_items&#039; =&gt; $total_items,                  //WE have to calculate the total number of items
    &#039;per_page&#039;    =&gt; $per_page                     //WE have to determine how many items to show on a page
  ) );
  $this-&gt;items = $this-&gt;found_data;
}</pre>
<p>As pointed out in the comment the <code>array_slice</code> is only necessary because we use sample data. If you're retrieving the data from a database you only need to load the necessary data by using SQL's <code>LIMIT</code>.</p>
<h3 id="searching">Searching</h3>
<p>If you have a huge amount of data a search field will simplify accessing certain items:</p>
<pre lang="PHP">$myListTable-&gt;search_box(&#039;search&#039;, &#039;search_id&#039;);</pre>
<p>The button text <code>search</code> is defined by the first parameter, the id of the input by the second parameter. The method creates the following output:</p>
<pre lang="xhtml">
&lt;p class=&quot;search-box&quot;&gt;
&lt;label class=&quot;screen-reader-text&quot; for=&quot;search_id-search-input&quot;&gt;
search:&lt;/label&gt;
&lt;input id=&quot;search_id-search-input&quot; type=&quot;text&quot; name=&quot;s&quot; value=&quot;&quot; /&gt;
&lt;input id=&quot;search-submit&quot; class=&quot;button&quot; type=&quot;submit&quot; name=&quot;&quot; value=&quot;search&quot; /&gt;
&lt;/p&gt;
</pre>
<p>The method will place the input field and the search button on the right side and style it correctly. The <code>&lt;form></code> element is not generated. You have to add it manually, in our case this would be:</p>
<pre lang="xhtml">
&lt;form method=&quot;post&quot;&gt;
  &lt;input type=&quot;hidden&quot; name=&quot;page&quot; value=&quot;my_list_test&quot; /&gt;
  &lt;?php $this-&gt;search_box(&#039;search&#039;, &#039;search_id&#039;); ?&gt;
&lt;/form&gt;
</pre>
<p>(The hidden element is needed to load the right page.)<br />
To react to the search command you need to check the content of <code>$_POST['s']</code> and filter your data accordingly before displaying the table.</p>
<p><img src="http://wpengineer.com/wp-content/uploads/21-03-2012-18-17-33.png" alt="" title="Searching" width="381" height="151" class="aligncenter size-full wp-image-2433" /></p>
<h3 id="screen-options">Screen options</h3>
<p>All core backend pages containing a <code>WP_List_Table</code> provide a "Screen Options" slide-in where the user can adjust the columns to be shown and the number of rows to be displayed.<br />
To add options to your plugin you need to change your current code. First you have to make sure that the screen options are displayed only on the current page:</p>
<pre lang="PHP">$hook = add_menu_page(&#039;My Plugin List Table&#039;, &#039;My List Table Example&#039;, &#039;activate_plugins&#039;, &#039;my_list_test&#039;, &#039;my_render_list_page&#039;);
add_action( &quot;load-$hook&quot;, &#039;add_options&#039; );

function add_options() {
  $option = &#039;per_page&#039;;
  $args = array(
         &#039;label&#039; =&gt; &#039;Books&#039;,
         &#039;default&#039; =&gt; 10,
         &#039;option&#039; =&gt; &#039;books_per_page&#039;
         );
  add_screen_option( $option, $args );
}</pre>
<p><img src="http://wpengineer.com/wp-content/uploads/21-03-2012-18-25-17.png" alt="" title="Screen options 1" width="568" height="116" class="aligncenter size-full wp-image-2434" /></p>
<p>This only displays the option field and apply button, saving and loading the data has to be defined separately. WordPress provides a filter called <code>set-screen-option</code> to take care of this:</p>
<pre lang="php">
add_filter(&#039;set-screen-option&#039;, &#039;test_table_set_option&#039;, 10, 3);
function test_table_set_option($status, $option, $value) {
  return $value;
}
</pre>
<p>The option is stored in the table <code>usermeta</code> in the database so each user has his own setting. To retrieve the option and adjust the table display accordingly the method <code>prepare_items</code> has to be altered (excerpt):</p>
<pre lang="php">
function prepare_items() {
&#091;..&#093;

  //paging
  $per_page = $this-&gt;get_items_per_page(&#039;books_per_page&#039;, 5);
  $current_page = $this-&gt;get_pagenum();

  &#091;...&#093;
</pre>
<p>Instead of simply assigning a number the user specified value is loaded. If the user hasn't changed the value there is no such option stored in the database and a default value is taken.</p>
<p>Adding the checkboxes for hiding/showing the columns is done by WordPress automatically. You just have to make sure that your derived class is instantiated before the screen option panel is rendered so that the parent class can retrieve the column names. To accomplish this the corresponding code is moved into the method <code>add_options()</code>:</p>
<pre lang="php">
function add_options() {
    global $myListTable;

    $option = &#039;per_page&#039;;
    $args = array(
        &#039;label&#039; =&gt; &#039;Books&#039;,
        &#039;default&#039; =&gt; 10,
        &#039;option&#039; =&gt; &#039;books_per_page&#039;
    );
    add_screen_option( $option, $args );

    $myListTable = new My_Example_List_Table;
}</pre>
<p><img src="http://wpengineer.com/wp-content/uploads/21-03-2012-18-32-02.png" alt="" title="Screen options 2" width="574" height="170" class="aligncenter size-full wp-image-2435" /></p>
<p>The user's selections are automatically saved via Ajax functions. Nevertheless you have take care by yourself that the columns are hidden if the page is loaded initially. The method <code>get_column_info()</code> returns all, the hidden and the sortable columns. In the method <code>prepare_items()</code> instead of</p>
<pre lang="php">
$columns = $this-&gt;get_columns();
$hidden = array();
$sortable = $this-&gt;get_sortable_columns();
$this-&gt;_column_headers = array($columns, $hidden, $sortable);
</pre>
<p>it's now</p>
<pre lang="php">
$this-&gt;_column_headers = $this-&gt;get_column_info();
</pre>
<p>and the columns are set according to the screen options.</p>
<p>Annotation: you should avoid some strings as keynames since they are treated by WordPress specially:</p>
<pre lang="php">
$special = array(&#039;_title&#039;, &#039;cb&#039;, &#039;comment&#039;, &#039;media&#039;, &#039;name&#039;, &#039;title&#039;, &#039;username&#039;, &#039;blogname&#039;);
</pre>
<p>Your table would still work, but you won't be able to show/hide the columns.</p>
<h3 id="styling">Styling the table</h3>
<p>Currently the table is styled to the WordPress defaults. To change this you have to adapt the CSS classes which are automatically assigned to each column. The class name consists of the string "column-" and the key name of the <code>$columns</code> array, e.g. "column-isbn" or "column-author". As an example the width of the columns will be redefined (for simplicity the style data is written directly into the HTML header):</p>
<pre lang="php">
function _construct() {
  &#091;...&#093;
  add_action( &#039;admin_head&#039;, array( &amp;$this, &#039;admin_header&#039; ) );
  &#091;...&#093;
}

function admin_header() {
  $page = ( isset($_GET&#091;&#039;page&#039;&#093; ) ) ? esc_attr( $_GET&#091;&#039;page&#039;&#093; ) : false;
  if( &#039;my_list_test&#039; != $page )
    return; 

  echo &#039;&lt;style type=&quot;text/css&quot;&gt;&#039;;
  echo &#039;.wp-list-table .column-id { width: 5%; }&#039;;
  echo &#039;.wp-list-table .column-booktitle { width: 40%; }&#039;;
  echo &#039;.wp-list-table .column-author { width: 35%; }&#039;;
  echo &#039;.wp-list-table .column-isbn { width: 20%; }&#039;;
  echo &#039;&lt;/style&gt;&#039;;
}
</pre>
<h3 id="other">Other customizations</h3>
<p>If there are no items in the list the standard message is "No items found." is displayed. If you want to change this message you can overwrite the method <code>no_items()</code>:</p>
<pre lang="php">
function no_items() {
  _e( &#039;No books found, dude.&#039; );
}
</pre>
<p><a href="https://gist.github.com/gists/7f923479a4ed135e35b2/download" title="Download Gist">Download complete WP_List_Table example</a> (gist) or <a href="https://gist.github.com/7f923479a4ed135e35b2" title="Gist: Sample plugin for usage of WP_List_Table class (complete version)">see the Gist</a></p>
<h3 id="links">Weblinks</h3>
<ul>
<li><a href="http://wp.smashingmagazine.com/2011/11/03/native-admin-tables-wordpress/">Create Native Admin Tables In WordPress The Right Way</a> (Smashing Magazine)</li>
<li><a href="http://wordpress.org/extend/plugins/custom-list-table-example/">Custom List Table Example plugin</a> (wordpress.org)</li>
</ul>
</li>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2426/wp_list_table-a-step-by-step-guide/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Best Practice for Multilanguage WordPress Content? New Plugin!</title>
		<link>http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/</link>
		<comments>http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 07:00:20 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[language plugin]]></category>
		<category><![CDATA[Multilanguage]]></category>
		<category><![CDATA[multilnual]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2389</guid>
		<description><![CDATA[Since the beginning of WordPress the desire to publish the content in different languages is huge. But the topic can quickly become complex, because not only the rendering of content in the form of text in different languages ​​is an issue, we also have to take care of the meta data for content, for images [...]]]></description>
			<content:encoded><![CDATA[<p>Since the beginning of WordPress the desire to publish the content in different languages is huge. But the topic can quickly become complex, because not only the rendering of content in the form of text in different languages ​​is an issue, we also have to take care of the meta data for content, for images that can be different depending on the language and the use of the admin interface in the preferred language. Thus, only a part would be covered depending on the requirements (<a href="http://wordpress.stackexchange.com/questions/1552/best-practices-for-localizing-wordpress-content">a example on StackExchange</a>) it would quickly become an project and WordPress would be just a "small" framework behind it. There are already many <a href="http://codex.wordpress.org/Multilingual_WordPress">Plugins available</a>, the different approaches - new tables in the system or separation of content for each language in a table entry to post, or other solutions.</p>
<p>All these solutions have their limitations, are inflexible and you go into a dependency that will be hard to get out and with each update of WordPress you have to check if the Plugin is still working or has any bugs with the new version. Therefore, I would suggest a solution that we use in our <a title="Inpsyde photo" href="http://inpsyde.com">Inpsyde Team</a> frequently for customers and maintained their strength in the flexibility, in extensibility and in its capacity to use the WordPress standard without changing the core or anything else. You can deactivate the Plugin at any time, you won't lose anything, your website remains the same.</p>
<p><span id="more-2389"></span><br />
<img class="aligncenter size-medium wp-image-2390" title="banner-772x250" src="http://wpengineer.com/wp-content/uploads/banner-772x250-300x97.png" alt="" width="300" height="97" /></p>
<h3>Why multilanuage?</h3>
<ul>
<li>2/3, if not even more, of the worldwide population speak another language</li>
<li>Globale Aufstellung von Unternehmen</li>
<li>Better distribution of content</li>
<li>Service for the client</li>
<li>Search Engine Optimization</li>
</ul>
<h3>The solution</h3>
<p>WordPress Multi-site provides the solution already.<br />
This makes the management of different instances, with similarities and differences, with the help of an installation possible. The exchange of data is possible via core functions, which get united and simplified via Plugin.</p>
<h3>Advantages</h3>
<ul>
<li>WordPress Core Functions</li>
<li>No dependency to Plugins</li>
<li>Independent to WordPress development*</li>
<li>Control Themes, Plugins at a central place, use them decentralized</li>
<li>Low maintenance</li>
<li>Seperating languages in Backend/Frontend (user dependent)</li>
<li>Complete mirrored or in every content form seperated</li>
<li>Subdomains or Subdirectories</li>
<li>de.example.com, example.com/de</li>
<li>Seperate Domains via Domainmapping</li>
<li>example.de, example.com</li>
<li>Free in development in design and usability</li>
<li>Optimization not only on frontend, also lang-attributes, SEO</li>
</ul>
<h3>Plugin</h3>
<p>With all these requirements and benefits, we use a base that is available as a Plugin in the official repository of WordPress: <a href="http://wordpress.org/extend/plugins/multilingual-press/"> Multilingual Press </a>. The plugin provides several convenient tools to use Multisite for the implementation of multilingualism.</p>
<p>
<a href='http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/banner-772x250/' title='banner-772x250'><img width="150" height="150" src="http://wpengineer.com/wp-content/uploads/banner-772x250-150x150.png" class="attachment-thumbnail" alt="banner-772x250" title="banner-772x250" /></a>
<a href='http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/screenshot-1-3/' title='screenshot-1'><img width="150" height="150" src="http://wpengineer.com/wp-content/uploads/screenshot-12-150x150.png" class="attachment-thumbnail" alt="screenshot-1" title="screenshot-1" /></a>
<a href='http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/screenshot-2-3/' title='screenshot-2'><img width="150" height="150" src="http://wpengineer.com/wp-content/uploads/screenshot-22-150x150.png" class="attachment-thumbnail" alt="screenshot-2" title="screenshot-2" /></a>
<a href='http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/screenshot-3/' title='screenshot-3'><img width="150" height="150" src="http://wpengineer.com/wp-content/uploads/screenshot-3-150x150.png" class="attachment-thumbnail" alt="screenshot-3" title="screenshot-3" /></a>
<a href='http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/screenshot-4/' title='screenshot-4'><img width="150" height="150" src="http://wpengineer.com/wp-content/uploads/screenshot-4-150x150.png" class="attachment-thumbnail" alt="screenshot-4" title="screenshot-4" /></a>
<a href='http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/wordpress-christmas-2010-24-2/' title='WordPress-Christmas-2010-24'><img width="150" height="150" src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-241-150x150.jpg" class="attachment-thumbnail" alt="WordPress-Christmas-2010-24" title="WordPress-Christmas-2010-24" /></a>
</p>
<p>This plugin simplifies the identification of different blogs in the network to a language and linking to other blogs, so that when you publish the content in blog A, it will create a post as draft in blog B. Thus, the articles are in relation, the system knows this and with the help of some functions, it may be used in the frontend and backend.<br />
The Plugin provides in the article or page the ability to see a meta box with the content of the linked data, in the simplest case as a translation aid. Similarly, there is a widget that simplifies the frontend to change. In each blog you can be make ​​some adjustments, assigning a flag and language.</p>
<h3>An outlook</h3>
<p>We are in the midst of the development, which adds the extra help. For example a dashboard widget with the overview of article and all links, an extension of the mediathek to seperate global content across all blogs and independent content per blog. Similarly, there are helpers for updating existing installations. In addition there is the possibility to directly load the language in the backend, without the need of FTP/SSH and assign the languages accordingly​​. We will also add the function to copy existing blogs with all the content and options if you want to.</p>
<h3>Summary</h3>
<p>WordPress Multisite provides the basis and with some adjustments, a clean, controlled solution exists for the use of WordPress in a multilingual environment. Now it's up to you - use Multisite, Test the Plugin and give us a feedback, preferable on <a href="https://github.com/inpsyde/multilingual-press">our repo on Github</a>.</h3>
<p>.</p>
<p>This was our last door of our Advent Calendar. We hope you enjoyed it! </p>
<p>We wish you a Merry Christmas and thanks a lot for reading our posts!<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2389/best-practice-for-multilanguage-wordpress-content-new-plugin/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Easier Plugin Development by Moving Plugin Directory</title>
		<link>http://wpengineer.com/2374/easier-plugin-development-by-moving-plugin-directory/</link>
		<comments>http://wpengineer.com/2374/easier-plugin-development-by-moving-plugin-directory/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 07:07:50 +0000</pubDate>
		<dc:creator>Latz</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2374</guid>
		<description><![CDATA[If you're a experienced programmer you're testing your programs not only with the latest version of WordPress but also with some older versions since there are many dated installations. So you have several versions installed on your development server and want to test your newly created code with every single version. You could copy your [...]]]></description>
			<content:encoded><![CDATA[<p>If you're a experienced programmer you're testing your programs not only with the latest version of WordPress but also with some older versions since there are <a title="WordPress Infographic" href="http://hackertarget.com/wordpress-infographic/">many dated installations</a>. So you have several versions installed on your development server and want to test your newly created code with every single version.<br />
<span id="more-2374"></span><br />
You could copy your plugin files to all installed version's plugin directory manually every time you change the code... but you're a programmer, so this is no option, is it?<br />
If your dev server works under a *nix system you probably have tried to use symbolic links but it didn't work. This is not a bug of WordPress but <a href="https://bugs.php.net/bug.php?id=46260">of PHP</a>. So this does not work either.</p>
<p>Fortunately WordPress defines two constants which can help you to simplify things nonetheless: <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code>. These constants point to the plugin directory of the respective WordPress installation. They are defined since WordPress 2.6 and supporting older versions is most likely unnecessary<br />
.<br />
To make your plugins accessible to all your installed WordPress versions you simply move them to a central directory and define the constants accordingly:</p>
<pre lang="php">
define( &#039;WP_PLUGIN_DIR&#039;, &#039;/var/www/plugins&#039; ); // or with XAMPP C:/xampp/htdocs/plugins
define( &#039;WP_PLUGIN_URL&#039;, &#039;http://localhost/plugins&#039; );
</pre>
<p>In this example the plugins reside in the directory 'plugins' in the root directory of the webserver. If you now define the above constants in every WordPress installation you have easy access to them to test your code with every version. </p>
<p>(Thanks to <a href="http://profiles.wordpress.org/users/johnbillion">John Blackbourn</a> on the <a href="http://lists.automattic.com/mailman/listinfo/wp-hackers">wp-hackers</a> list for having the idea.)</p>
<h4>Hint for Multisite-Users</h4>
<p>Also usable for WordPress Multisite</p>
<pre lang="php">
define( &#039;WPMU_PLUGIN_DIR&#039;, &#039;/var/www/multisite-plugins&#039; );
define( &#039;WPMU_PLUGIN_URL&#039;, &#039;http://localhost/multisite-plugins&#039; );
</pre>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2374/easier-plugin-development-by-moving-plugin-directory/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>WordPress Import Not Include In WP Core</title>
		<link>http://wpengineer.com/2026/wordpress-import-not-include-in-wp-core/</link>
		<comments>http://wpengineer.com/2026/wordpress-import-not-include-in-wp-core/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 09:30:34 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[WP]]></category>
		<category><![CDATA[WP3.0]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2026</guid>
		<description><![CDATA[WordPress came with several new or changed features - one feature which changed is the functionality to import content from other systems. WordPress offers under "Tools" to import data of other applications or a XML-file of another WordPress installation. But since WordPress 3.0 you need a Plugin because it is no longer in WordPress core. [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress came with several new or changed features - one feature which changed is the functionality to import content from other systems.<br />
<span id="more-2026"></span><br />
WordPress offers under "Tools" to import data of other applications or a XML-file of another WordPress installation. But since WordPress 3.0 you need a Plugin because it is no longer in WordPress core. The installation of the Plugin is easy and has the usual steps to activate a Plugin.</p>
<p><a href="http://wpengineer.com/wp-content/uploads/wp-importer.png"><img src="http://wpengineer.com/wp-content/uploads/wp-importer-300x112.png" alt="" title="wp-importer" width="300" height="112" class="aligncenter size-medium wp-image-2027" /></a></p>
<p>This is the first time, that WordPress is going into the direction of using <a href="http://wpengineer.com/core-plugins/">Core-Plugins</a>. There are many formats available if you check out the <a href="http://wordpress.org/extend/plugins/profile/wordpressdotorg">profile of WordPress</a>, and maybe someone can create additional importers for other formats.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2026/wordpress-import-not-include-in-wp-core/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Development: Style Your Message Boxes</title>
		<link>http://wpengineer.com/2004/wordpress-plugin-development/</link>
		<comments>http://wpengineer.com/2004/wordpress-plugin-development/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 05:53:32 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[Plugin Development]]></category>
		<category><![CDATA[WordPress Admin]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2004</guid>
		<description><![CDATA[Displaying a message to the user after he started an action belongs to a good usability. In the era of Web 2.0 applications, the user is expecting such optical signal after his actions. Also WordPress Plugin developer should give the user a result message, if necessary, provided with further information. The WordPress admin area often [...]]]></description>
			<content:encoded><![CDATA[<p>Displaying a message to the user after he started an action belongs to a good usability. In the era of Web 2.0 applications, the user is expecting such optical signal after his actions. Also WordPress Plugin developer should give the user a result message, if necessary, provided with further information.</p>
<p>The WordPress admin area often likes to show information at the top of the window. For developers, this has a great benefit: Tools for generating the error and information messages are integrated and can easily be implemented in Plugins - without any self-definitions or changes in the style sheet.</p>
<h4>Automatically generated information in WordPress</h4>
<pre lang="php">wp_safe_redirect(
  add_query_arg(
    &#039;updated&#039;,
    &#039;true&#039;,
    wp_get_referer()
  )
);
</pre>
<h4>Manual and more flexible solution to output a message box</h4>
<pre lang="php">&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;
  &lt;p&gt;
    Output
  &lt;/p&gt;
&lt;/div&gt;</pre>
<h4>Colorful: The availability of CSS classes</h4>
<p>Messages within an application have to communicate different informations. For this purpose WordPress has numerous stylesheet classes available, which suits best to the message.</p>
<pre lang="php">&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;...&lt;/div&gt;</pre>
<p><img src="http://wpengineer.com/wp-content/uploads/wordpress-messages_updated.png" alt="" title="wordpress-messages_updated" width="474" height="200" class="aligncenter size-full wp-image-2009" /></p>
<pre lang="php">&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;...&lt;/div&gt;</pre>
<p><img src="http://wpengineer.com/wp-content/uploads/wordpress-messages_error.png" alt="" title="wordpress-messages_error" width="474" height="200" class="aligncenter size-full wp-image-2007" /></p>
<pre lang="php">&lt;div id=&quot;message&quot; class=&quot;updated highlight&quot;&gt;...&lt;/div&gt;</pre>
<p><img src="http://wpengineer.com/wp-content/uploads/wordpress-messages_highlight.png" alt="" title="wordpress-messages_highlight" width="474" height="200" class="aligncenter size-full wp-image-2008" /></p>
<pre lang="php">&lt;div id=&quot;message&quot; class=&quot;updated below-h2&quot;&gt;...&lt;/div&gt;</pre>
<p><img src="http://wpengineer.com/wp-content/uploads/wordpress-messages_below.png" alt="" title="wordpress-messages_below" width="474" height="200" class="aligncenter size-full wp-image-2006" /></p>
<h4>Recommendation</h4>
<p>Don't use your own format. A common and familiar message box provides trust and increases the potential of perception.</p>
<h4>Guest Post</h4>
<p><img src="http://wpengineer.com/wp-content/uploads/sergej_mueller.jpg" alt="" title="sergej_mueller" width="64" height="64" class="alignleft size-full wp-image-2005" />This post is written by Sergej Müller <a href="http://wpseo.org">wpseo.org</a>, who created the popular WordPress Plugin to optimize your SEO.</p>
<p>Thank you very much from our part to Sergej.</p>
<p>If you also like to have your interesting post published on our website, please let us know on our contact page. Of course we will appreciate your contribution! </p>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2004/wordpress-plugin-development/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>WordPress: Useful Default Configuration Settings Via Plugin</title>
		<link>http://wpengineer.com/1957/wordpress-useful-default-configuration-settings-via-plugin/</link>
		<comments>http://wpengineer.com/1957/wordpress-useful-default-configuration-settings-via-plugin/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 11:24:41 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1957</guid>
		<description><![CDATA[Everybody who installs WordPress quite often knows the problem: You always have to do the same adjustments, for example deleting the Hello World post. That cost time and money. Our friend Thomas Scholz alias toscho had a simple but genius idea, he puts all needed option settings in a Plugin. Just activate the Plugin, deactivate [...]]]></description>
			<content:encoded><![CDATA[<p>Everybody who installs WordPress quite often knows the problem: You always have to do the same adjustments, for example deleting the Hello World post. That cost time and money. Our friend <a href="http://toscho.de/" title="Toscho Design">Thomas Scholz</a> alias toscho had a simple but genius idea, he puts all needed option settings in a Plugin. Just activate the Plugin, deactivate it and delete it. Done!</p>
<p>You can adjust and expand the options as you like. A good overview is the wp-admin/options.php.</p>
<pre lang="php">
&lt;?php
/*
Plugin Name: Toscho&#039;s basic settings
Plugin URI: http://toscho.de/2010/wordpress-grundeinstellungen-per-plugin-setzen/
Description: Some useful default configuration settings. See &#039;wp-admin/options.php&#039; for more options.
Version: 0.2
Author: Thomas Scholz
Author URI: http://toscho.de
*/

function set_toscho_defaults()
{
    $o = array(
        &#039;avatar_default&#039;            =&gt; &#039;blank&#039;,
        &#039;avatar_rating&#039;             =&gt; &#039;G&#039;,
        &#039;category_base&#039;             =&gt; &#039;/thema&#039;,
        &#039;comment_max_links&#039;         =&gt; 0,
        &#039;comments_per_page&#039;         =&gt; 0,
        &#039;date_format&#039;               =&gt; &#039;d.m.Y&#039;,
        &#039;default_ping_status&#039;       =&gt; &#039;closed&#039;,
        &#039;default_post_edit_rows&#039;    =&gt; 30,
        &#039;links_updated_date_format&#039; =&gt; &#039;j. F Y, H:i&#039;,
        &#039;permalink_structure&#039;       =&gt; &#039;/%year%/%postname%/&#039;,
        &#039;rss_language&#039;              =&gt; &#039;de&#039;,
        &#039;timezone_string&#039;           =&gt; &#039;Etc/GMT-1&#039;,
        &#039;use_smilies&#039;               =&gt; 0,
    );

    foreach ( $o as $k =&gt; $v )
    {
        update_option($k, $v);
    }

    // Delete dummy post and comment.
    wp_delete_post(1, TRUE);
    wp_delete_comment(1);

    return;
}
register_activation_hook(__FILE__, &#039;set_toscho_defaults&#039;);
?&gt;
</pre>
<p>Here you can <a href="http://f.toscho.de/php-skripte/toscho_basic_settings-0.2.zip" title="Download toschos plugin">download</a> the Plugin by toscho.</p>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/1957/wordpress-useful-default-configuration-settings-via-plugin/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Check If Required Plugin Is Active</title>
		<link>http://wpengineer.com/1657/check-if-required-plugin-is-active/</link>
		<comments>http://wpengineer.com/1657/check-if-required-plugin-is-active/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 11:59:36 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1657</guid>
		<description><![CDATA[It might be, that your own written Plugin requires another stand alone Plugin to be active. For example if you like to offer a version with enhanced functionality of a Plugin. There are certainly a variety of usage and the implementation is not difficult. For the implementation, we need the active Plugins, which are found [...]]]></description>
			<content:encoded><![CDATA[<p>It might be, that your own written Plugin requires another stand alone Plugin to be active. For example if you like to offer a version with enhanced functionality of a Plugin. There are certainly a variety of usage and the implementation is not difficult.<br />
<! - more -></p>
<p>For the implementation, we need the active Plugins, which are found in the database, table <code>options</code>, the <code>active_plugins</code>. Afterwards, I will simply look in the array, which contains the active Plugins, whether the required plugin included and active or not:</p>
<pre lang="php">
$plugins = get_option(&#039;active_plugins&#039;);
$required_plugin = &#039;debug_queries/debug_queries.php&#039;;
$debug_queries_on = FALSE;
if ( in_array( $required_plugin , $plugins ) ) {
	$debug_queries_on = TRUE; // Example for yes, it&#039;s active
}
</pre>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/1657/check-if-required-plugin-is-active/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Warning Message For Self Customized Plugins</title>
		<link>http://wpengineer.com/1486/warning-message-for-self-customized-plugins/</link>
		<comments>http://wpengineer.com/1486/warning-message-for-self-customized-plugins/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 14:25:36 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1486</guid>
		<description><![CDATA[Now and then you have to modify an existing Plugin for your own special needs. But you still get a message if an update exists for the original Plugin. If you modified the Plugin several month ago and you forgot about it, so you update the Plugin and all your modifications are gone. Most of [...]]]></description>
			<content:encoded><![CDATA[<p>Now and then you have to modify an existing Plugin for your own special needs. But you still get a message if an update exists for the original Plugin. If you modified the Plugin several month ago and you forgot about it, so you update the Plugin and all your modifications are gone. Most of the time you have a backup, but even though it's annoying to upload the customized Plugin again after you realized the original Plugin is not exactly what you want. Therefore you can paste a little function in the specified Plugin to display a warning right after the update message. So you won't forget, that you modified this Plugin a while ago.</p>
<p><a href="http://wpengineer.com/wp-content/uploads/plugin-modified-warning.jpg"><img src="http://wpengineer.com/wp-content/uploads/plugin-modified-warning-small.jpg" alt="plugin-modified-warning-small" title="plugin-modified-warning-small" width="500" height="180" class="aligncenter size-full wp-image-1498" /></a></p>
<pre lang="php">
function my_update_notice() {
	$info = __( &#039;ATTENTION! Plugin was modified.&#039;, MY_TEXTDOMAIN );
	echo &#039;&lt;span class=&quot;spam&quot;&gt;&#039; . strip_tags( $info, &#039;&lt;br&gt;&lt;a&gt;&lt;b&gt;&lt;i&gt;&lt;span&gt;&#039; ) . &#039;&lt;/span&gt;&#039;;
}

if ( is_admin() )
	add_action( &#039;in_plugin_update_message-&#039; . plugin_basename(__FILE__), &#039;my_update_notice&#039; );
</pre>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/1486/warning-message-for-self-customized-plugins/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>A Chance: WordPress Plugin Competition</title>
		<link>http://wpengineer.com/1445/a-chance-wordpress-plugin-competition/</link>
		<comments>http://wpengineer.com/1445/a-chance-wordpress-plugin-competition/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 12:32:39 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1445</guid>
		<description><![CDATA[No matter for what reason we developed Plugins, whether hobby coder, professional or agencies working with clients, the variety of Plugins supports the continued growth of the WordPress community. Nevertheless, just one event in the year is dedicated to Plugins for WordPress - The Plugin Competition. Here you can present your Plugin to the community [...]]]></description>
			<content:encoded><![CDATA[<p>No matter for what reason we developed Plugins, whether hobby coder, professional or agencies working with clients, the variety of Plugins supports the continued growth of the WordPress community. Nevertheless, just one event in the year is dedicated to Plugins for WordPress - The <a href="http://weblogtoolscollection.com/pluginblog/">Plugin Competition</a>. Here you can present your Plugin to the community and win <a href="http://weblogtoolscollection.com/plugin-competition-prizes/">prices</a>.</p>
<p><img src="http://wpengineer.com/wp-content/uploads/wltcpl09.png" alt="wltcpl09" title="wltcpl09" width="468" height="60" class="aligncenter size-full wp-image-1446" /><br />
<span id="more-1445"></span></p>
<h3>For What Reason</h3>
<p>The competition is running until the end of July and there are only 13 submitted plugins so far. Including some great ideas. Even though every day new Plugins appear in <a href="http://wordpress.org/extend/plugins/">SVN</a>, there are just a few listed. Developers - dare you, chime into this competition. This event is an added value for users and developers, both sides can only gain from this. Sure, it's hard to compete against a professional PHP developer - but also in <a href="http://wordpress.org/extend/plugins/">SVN</a> is your code available to the public and therefore can seen by everyone. The <a href="http://weblogtoolscollection.com/pluginblog/">Plugin Competition</a> is just another platform, and should be used by beginners and pros.<br />
It doesn't make the plugin better, but your Plugin surely gets more attention and more feedback, as I have experienced in the past year. This year should be at least the same amount of feedback as last year, where each plugin was inspect by OZH. Also this year, you can expect to get some feedback from Ozh as you can see at <a href="http://planetozh.com/blog/2009/07/lets-get-more-contestants-into-the-wordpress-plugin-competition/">contribution to the Plugin Competition</a>. Sure, the opinion of Ozh can be different then yours, but his feedback is crucial. As a developer, I have learned a lot from last year, my knowledge expanded.</p>
<p>The competition doesn't cost you extra time. Your plugin will receive an additional platform and will be evaluated. Additionally, you can also win some prices and get recognition. Therefore - join in!</p>
<h3>Sponsoring</h3>
<p>The competition is a wonderful platform for people who want promote their product in front of a big WordPress user audience. It is a great opportunity for Theme and Plugin authors, agencies, and hosting services, etc. - sponsor the competition and get attention.</p>
<h3>Our German Community</h3>
<p>WP Engineer is driven by a German team and therefore it would be great to see more Plugins from German developers. As of now there are 2 German Plugins in the competition. I hope there will participating a <a href="http://www.code-styling.de/english/development/wordpress-plugin-codestyling-localization-en">third Plugin</a> soon. Because it deserves attention. I hope there will be more German Plugin developers in this competition and German users, who are voting for their favorite Plugin. A great opportunity to show how big and alive the German WordPress community is.</p>
<ul>
<li><a href="http://weblogtoolscollection.com/pluginblog/2009/06/30/changelogger/">Changelogger</a> by <a href="http://www.schloebe.de/">Oliver Schlöbe</a></li>
<li><a href="http://weblogtoolscollection.com/pluginblog/2009/06/30/debug-objects/">Debug Objects</a>, by me.</li>
</ul>
<p>The developers of WordPress will surely have an eye on this competition. It wouldn't be the first time a Plugin find it's way in the WordPress core or the solution of a Plugin was better than the solution in the core.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/1445/a-chance-wordpress-plugin-competition/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Recents Drafts All Authors</title>
		<link>http://wpengineer.com/1343/recents-drafts-all-authors/</link>
		<comments>http://wpengineer.com/1343/recents-drafts-all-authors/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 11:36:20 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[Feed]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Widget]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1343</guid>
		<description><![CDATA[It's not uncommon that a blog runs by different authors, so it may be useful if you can have a quick look at the drafts of all authors. In our joint blog WP Engineer we created a feed, which keeps us up to date if a new draft of all authors were created. The work [...]]]></description>
			<content:encoded><![CDATA[<p>It's not uncommon that a blog runs by different authors, so it may be useful if you can have a quick look at the drafts of all authors. In our joint blog WP Engineer we created a feed, which keeps us up to date if a new draft of all authors were created.</p>
<p>The work of every author is different and the dashboard is the center of information. Therefore we have decided to supplement a widget in the Dashboard, which shows the last five drafts of all authors. I enhanced the existing Plugin <a href="http://wpengineer.com/feed-for-drafts-plugin/">Draft Feed</a>.</p>
<ul>
<li>It provides a feed of all drafts</li>
<li>And the last 5 drafts of all authors in the Dashboard.</li>
</ul>
<p><span id="more-1343"></span><br />
<img src="http://wpengineer.com/wp-content/uploads/recents_draft.png" alt="recents_draft" title="recents_draft" width="362" height="225" class="aligncenter size-full wp-image-1344" /></p>
<p>Everybody who needs something like this, can download this Plugin from my <a href="http://bueltge.de/wordpress-feed-fuer-entwuerfe/829/">German Blog</a>. It doesn't have any options and doesn't exist in SVN of WordPress - if you want you can use and expand it or leave a comment if you have a question. Enjoy!<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/1343/recents-drafts-all-authors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

