Obțineți numele categoriei de tip post personalizat în wordpress

Exemple de cod

3
0

creați un tip de postare personalizat cu categoria în funcțiile wordpress.php

function create_posttype() {
  register_post_type( 'wpll_product',
    array(
      'labels' => array(
        'name' => __( 'Products' ),
        'singular_name' => __( 'Product' )
      ),
      'public' => true,
      'has_archive' => true,
      'rewrite' => array('slug' => 'products'),
    )
  );
}
add_action( 'init', 'create_posttype' );
1
0

obțineți numele personalizat post tip wordpress

$pt = get_post_type_object( 'books' );

// These two usually contain the post type name in plural. 
// They may differ though.
echo $pt->label;
echo $pt->labels->name;

// This one holds the post type name in singular.
echo $pt->labels->singular_name;
0
0

WP crea personalizat post tip și categorie

add_action( 'init', 'create_news' );
function create_news ()
{      
    register_post_type( 'ecommerces',
                array(
                'labels'        => array(
                'name'          => __( 'Ecommerces' ),
                'singular_name' => __( 'Ecommerce' )
                ),
                'public'   => true,
                'supports' => array ('title', 'editor', 'thumbnail')
                )
                );

    register_taxonomy(
                'ecommerce_cat',
                'ecommerces',
                array(
                'labels' => array(
                'name' => 'Ecommerce Categories',
                'add_new_item' => 'Add New Ecommerce Category',
                'new_item_name' => "New Ecommerce Category"
                ),
                'show_ui' => true,
                'show_tagcloud' => false,
                'hierarchical' => true,
                'hasArchive' => true
                )
                );

    }

    if ( function_exists( 'add_theme_support' ) ) {
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 100, 100, true ); 
}

    ?>

Pagini similare

Pagini similare cu exemple

În alte limbi

Această pagină este în alte limbi

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................