MO::make_entry() WordPress Method
The MO::make_entry() method is used to create a new WordPress post. This method takes two arguments: the post title and the post content. The post title is used to generate the post slug (i.e. the URL of the post), so it should be short and descriptive. The post content can be longer, and can include HTML tags. Once the post is created, you can use the MO::set_post_thumbnail() method to set a featured image for the post.
MO::make_entry( string $original, string $translation ) #
Build a Translation_Entry from original string and translation strings, found in a MO file
Parameters
- $original
(string)(Required)original string to translate from MO file. Might contain 0x04 as context separator or 0x00 as singular/plural separator
- $translation
(string)(Required)translation string from MO file. Might contain 0x00 as a plural translations separator
Return
(Translation_Entry) Entry instance.
Source
File: wp-includes/pomo/mo.php
public function &make_entry( $original, $translation ) { $entry = new Translation_Entry(); // Look for context, separated by \4. $parts = explode( "\4", $original ); if ( isset( $parts[1] ) ) { $original = $parts[1]; $entry->context = $parts[0]; } // Look for plural original. $parts = explode( "\0", $original ); $entry->singular = $parts[0]; if ( isset( $parts[1] ) ) { $entry->is_plural = true; $entry->plural = $parts[1]; } // Plural translations are also separated by \0. $entry->translations = explode( "\0", $translation ); return $entry; }
Expand full source codeCollapse full source codeView on TracView on GitHub