Making WordPress.org

Changeset 1298


Ignore:
Timestamp:
02/24/2015 07:31:13 AM (10 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Add DocBlocks to Dashicons code samples.

Fixes #877.
Props DrewAPicture.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/page-dashicons.php

    r1272 r1298  
    336336
    337337<pre>&lt;?php
    338 add_action( 'init', 'create_post_type' );
    339 //Registers the Product's post type
    340 function create_post_type() {
     338/**
     339 * Register the Product post type with a Dashicon.
     340 *
     341 * @see register_post_type()
     342 */
     343function wpdocs_create_post_type() {
    341344    register_post_type( 'acme_product',
    342345        array(
    343346            'labels' => array(
    344                 'name' => __( 'Products' ),
    345                 'singular_name' => __( 'Product' )
     347                'name'          => __( 'Products', 'textdomain' ),
     348                'singular_name' => __( 'Product', 'textdomain' )
    346349            ),
    347             'public' => true,
     350            'public'      => true,
    348351            'has_archive' => true,
    349             'menu_icon' => 'dashicons-products',
     352            'menu_icon'   => 'dashicons-products',
    350353        )
    351354    );
    352355}
     356add_action( 'init', 'wpdocs_create_post_type', 0 );
    353357</pre>
    354358
     
    359363
    360364<pre>&lt;?php
    361 function add_my_custom_menu() {
    362     //add an item to the menu
     365/**
     366 * Register a menu page with a Dashicon.
     367 *
     368 * @see add_menu_page()
     369 */
     370function wpdocs_add_my_custom_menu() {
     371    // Add an item to the menu.
    363372    add_menu_page (
    364         'My Page',
    365         'My Title',
     373        __( 'My Page', 'textdomain' ),
     374        __( 'My Title', 'textdomain' ),
    366375        'manage_options',
    367376        'my-page',
Note: See TracChangeset for help on using the changeset viewer.