Eric @ EricBess WebHome

Thinking blindly without action, it will be unknowingly become meaningless

Chinese (Simplified) flagItalian flagKorean flagPortuguese flagEnglish flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag
By N2H

WordPress plug-ins \ themes localization

Once you plug programming has ended, another area worth considering is how to plug your internationalization (of course, this is built on your work you want to release to the public on the premise). "Internationalize" is a building of your software so that the process can be localized; and "localize" the software is to show you the text translated into various languages process. WordPress has been from all over the world to use each of the local fans, so it will internationalization and localization features into its structure, including localization features plug-ins. Would like to learn more about the GNU gettext localization of background knowledge, please refer to translation of WordPress.

Strongly recommend that you plug your internationalization, so that the user name from all corners of the country can localize it. And this whole process is very straightforward:

  • Give you a translation of the plug-election to "text domain" name. This is generally the same file name of your plug-ins the same, of course, does not include. Php suffix names, and must be unique, at least not with the user has to ensure that the installation of other plug-ins of the same name.
  • Regardless of any time you want to use plug-ins to display text to the web page readers (that is, "Information text"), are embedded in them as much as possible the following two procedures WordPress gettext function of any paragraph. Remember, unlike the core WordPress code, in your plug-in function in the internationalization of you should use the second parameter to pass the text of your choice domain. While in the core WordPress code, this parameter is empty by default.

__ () Used to message as a parameter to another function. _e () used to write directly to the message page.

__ ($ message, $ domain): the localization of the language used for $ domain translation $ message. The output string can continue by other function call.
_e ($ message, $ domain): the localization of the language used for $ domain translation $ message, then display to the user's screen. If your text will be directly displayed to the reader, you can use this function.
  • For your plug-ins to create a POT file (this one included all the text of Article translation entry documents), with the release of your plug-ins. Plug create a user will need a good translation localization MO file, and then you put it in the same plug-ins folders. Mo file and this is also about the name, it should be as domain-ll_CC.mo, here is the local national and ll_CC language code (for example, zh_CN). With reference to translation of WordPress more on POT files, MO files and localized information.
  • In your plug-ins to add a subroutine to call load_plugin_textdomain plug your translation. This subroutine must be in front of your gettext function, but it was later the better (because some multi-language plug-in calls will change some of the geographical settings). One possible way is to plug in all your routines in front of an initial increase in Subroutine. For example, suppose you the text of the domain name "fabfunc", are:

Click to continue reading

October 27th, 2008 Posted by eric | WordPress, Wordpress Programming, Web technology | no comments

Rewrite Permalinks in plugin development.

We add a rewrite rule that tells WordPress to interpret / geostate / oregon URLs the same as? Geostate = oregon.
there are two steps:

(1) "flush" the cached rewrite rules using an init filter, to force WordPress to recalculate the rewrite rules,
  add_action ( 'init', 'geotags_flush_rewrite_rules'); 

  function geotags_flush_rewrite_rules () 
  ( 
     global $ wp_rewrite; 
     $ wp_rewrite-> flush_rules (); 
  ) 
(2) use the generate_rewrite_rules action to add a new rule when they are calculated. Here's the "flush" code:
  add_action ( 'generate_rewrite_rules',' geotags_add_rewrite_rules'); 

  function geotags_add_rewrite_rules ($ wp_rewrite) 
  ( 
    $ new_rules = array ( 
       'geostate /(.+)' =>' index.php? geostate = '. 
         $ wp_rewrite-> preg_index (1)); 

    $ wp_rewrite-> rules = $ new_rules + $ wp_rewrite-> rules; 
  ) 

July 7th, 2008 Posted by eric | Wordpress Programming | no comments

One guy WP-Codebox release suggestion

Hello --

Let me first tell you that I love this plugin. Today I had the brilliant idea of changing the '+' and '-' symbol that are in the upper right corner of the box. I wanted to use an image instead. At first I just changed the 'main.php' file. That made the images appear fine when the page loaded. Although, once clicked on, it would go back to the text version. I determined that the problem was with the javascript file. I found where I though should be changed and I got it to work fine in Firefox, but it's getting stuck in Internet Explorer.

I've attached a text file of the changes that I've made. Is there any way that you can help me out with this?

Thank you so much!

Bill Fisher

Click to continue reading

June 20th, 2008 Posted by eric | Wordpress Programming | no comments

wordpress shortCode API

wordpress2.5 added a new code of Jane (shortCode) API, is a simple function sets, used to create the content of macro code. Jane code form as follows: [play] or [codebox ]...[/ codebox]

With Jane code API, created to support the following attributes Jane code becomes easy. Jane code API capable of handling all forms of analytical work, no longer need to prepare for each Jane code corresponding regular expression. Helper function also includes a Progressive API for access to the default settings and attributes. For self-closing and passive Jane closed code, API will provide support.

Overview

Jane code is used to provide processing functions. Jane code processor similar to a large extent wordpress filters filter: They all accept the parameters (attributes) and return results (Jane Code output). Function add_shortcode () for the registration code processor Jane. It has two parameters: Jane code name (for the article itself string) and the processor function names. Jane code processor function should accept 1-2 parameters: $ atts (the array of attributes) and $ content (of which the contents) (if the code for Jane form included).
For example: function my_shortcode_handler ($ atts, $ content = null) () for the registration code processor Jane API call,
Forms are as follows: add_shortcode ( 'my-shortcode', 'my_shortcode_handler');

When show time the_content, Jane code API will resolve all of the Jane code, such as "[my-shortcode]", if there are attributes and content, will be separated from them and resolve them, and then passed to the corresponding processors Jane Code function. Any string returned by the processor will be inserted into the article itself, replace Jane code location. Jane code attributes are as follows: [my-shortcode foo = "bar" baz = "bing"] code content ........[/ my-shortcode] they will be converted into an associative array (see below), as a $ atts Parameters passed to the processor function; content as $ content delivery.
array ( 'foo' => 'bar', 'baz' => 'bing') is an associative array of key attributes, while the value is the corresponding attribute values.

Click to continue reading

June 13th, 2008 Posted by eric | Wordpress Programming | no comments

wpdb create data tables wp use case

? View Code PHP
 1 
 2 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
 23 
 24 
 25 
 26 
 27 
 28 
 29 
 30 
 31 
 32 
 33 
 34 
  ; global $ wpdb; 
  donators = $wpdb -> prefix . 'donators' ; //Donators Table Name $ wpdb -> donators = $ wpdb -> prefix. 'donators'; / / Donators Table Name 
  # # # Function: Create Donators Table 
  , 'install' ) ; register_activation_hook (__FILE__, 'install'); 
  function install () ( 
	  ; global $ wpdb; 

	  @ is_file ( ABSPATH . '/wp-admin/upgrade-functions.php' ) ) { if (@ is_file (ABSPATH. '/ wp-admin/upgrade-functions.php')) ( 
		  ABSPATH . '/wp-admin/upgrade-functions.php' ) ; include_once (ABSPATH. '/ wp-admin/upgrade-functions.php'); 
	  ( @ is_file ( ABSPATH . '/wp-admin/includes/upgrade.php' ) ) { ) Elseif (@ is_file (ABSPATH. '/ Wp-admin/includes/upgrade.php')) ( 
		  ABSPATH . '/wp-admin/includes/upgrade.php' ) ; include_once (ABSPATH. '/ wp-admin/includes/upgrade.php'); 
	  { ) Else ( 
		  'We have problem finding your \' / wp - admin / upgrade - functions . php\ ' and \' / wp - admin / includes / upgrade . php\ '' ) ; die ( 'We have problem finding your \' / wp - admin / upgrade - functions. php \ 'and \' / wp - admin / includes / upgrade. php \''); 
	  ) 

	  / / Create Donators Table 
	  "CREATE TABLE $wpdb->donators  (" . $ create_table = "CREATE TABLE $ wpdb-> donators (". 
			  "ID bigint (20) NOT NULL auto_increment,". 
			  "BUYER_EMAIL varchar (100) NOT NULL default'',". 
			  "ITEMNAME varchar (255) NOT NULL default'',". 
			  "ITEMNUMBER varchar (50),". 
			  "URL varchar (255),". 
			  "USER_MEMO varchar (255),". 
			  "PAYMENTDATE varchar (50) NOT NULL default'',". 
			  "TXNID varchar (30) NOT NULL default'',". 
			  "PAYMENT_GROSS varchar (10) NOT NULL default'',". 
			  "PAYMENT_FEE varchar (10) NOT NULL default'',". 
			  "MC_CURRENCY varchar (5) NOT NULL default'',". 
			  "INVOICE varchar (255) NOT NULL default'',". 
			  "PRIMARY KEY (ID));"; 
	  -> donators , $create_table ) ; maybe_create_table ($ wpdb -> donators, $ create_table); 	  

	  , "1.0" ) ; Add_option ( "donators_db_version", "1.0"); 
  ) 

codex.wordpress: built Table document
http://codex.wordpress.org.cn/Creating_Tables_with_Plugins

April 29th, 2008 Posted by eric | Wordpress Programming | no comments

Wordpress database descriptions and category wpdb

The following collating information for the network of non-original

The following is a wp-2.0.5 version of the database structure diagram (ER diagram). Here, only lists the primary keys and foreign keys. Diamond-shaped figure that 1: n relationship between the white part 1, part black n.

wordpress-db-er-diagram.png

Wordpress a total of 10 tables, divided into four categories according to function.

  • user: the user's information, including wp_users table and wp_usermeta table.
  • post: articles and reviews information, including wp_posts, wp_postmeta, wp_comments, wp_post2cat and five wp_categories table.
  • link: links to information, including wp_links table and wp_linkcategories table.
  • option: global settings, including wp_options table.

Table naming rules also very interesting. The basic rules are summarized as follows:

  • To preserve the basic properties of the object, named wp_objects, the use of the plural (for example, wp_posts, wp_comments);
  • Save the expansion of the object attributes, named wp_objectmeta, the use of odd-numbered (for example, wp_postmeta, wp_usermeta);
  • Many-to-many relationship, named wp_a2b, in which a and b are the object of many-to-many relationship between the two ends of the abbreviations (such as wp_post2cat).
WPDB category

http://codex.wordpress.org.cn/Function_Reference/wpdb_Class

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

Database Help

http://codex.wordpress.org/Database_Description # Table_Overview

wp_categories: classification of relevant information for the preservation of the table. Includes five fields, namely:

  • cat_ID - the sole of each classification ID number, for a bigint (20) value, and with additional attributes auto_increment.
  • cat_name - a classification of the name, as a varchar (55) value.
  • category_nicename - assigned to the classification of a user-friendly name to remember, that is, the so-called slug, this is a varchar (200) value.
  • category_description - a detailed description of classification, longtext type value.
  • category_parent - the classification of the higher level classification, as an int (4) value, corresponding to is the current table cat_ID, namely wp_categories.cat_ID. No higher level classification, this value is 0.

Click to continue reading

March 12th, 2008 Posted by eric | Database, Wordpress Programming | no comments

WordPress Development Index

References

WordPress Development Documentation directory
WordPress Development Introduction
WordPress API hooks article, you can learn how to use their knowledge
WordPress hooks List

Recommended reading:

Do-It-Yourself WordPress write plug-ins: the use of API
The production of a simple plug-WP
Wordpress plug-in how to achieve ajax

The main API study

WordPress Plug-in Development to be familiar with the four function [load]
register_form used in the registration page to insert the password input box (of course you can also insert other content),
register_post used to intercept the password,
user_register from the database used to write just intercepted password (You might wonder, why do not directly in the action directly register_post write password? In fact, I would also like to do so, but will not do.
login_message used to prompt information in the registration page, for example, when you lose the wrong password, the overall message to give you feedback, right? This depends on things.
action (wp_head) [load]

February 10th, 2008 Posted by eric | Wordpress Programming | no comments

wp_head () references

Has been the use of plug-ins are not normal, all plug-ins do not have to quote their css, jp. Inadvertently change a theme would be no problem, look at the theme found in index.php, page.php, single.php not <? Php wp_head ();?>。

The original wp_head () used to obtain the required plug-ins into html the first <head> </ head> information. Therefore, the use of plug-WP must theme related pages <head> </ head> add it between: <? Php wp_head ();?>。 I propose to write it in head.php, the call by the other template.

January 23rd, 2008 Posted by eric | Wordpress Programming | no comments

2 » Page 1 of 2 1 2 »