Deprecated: 関数 WP_Dependencies->add_data() がバージョン 6.9.0 から非推奨になった引数付きで呼び出されました。IE の条件付きコメントは、対応しているすべてのブラウザで無視されます。 in /home/artws/woo-japan.info/public_html/wp-includes/functions.php on line 6131

Deprecated: 関数 WP_Dependencies->add_data() がバージョン 6.9.0 から非推奨になった引数付きで呼び出されました。IE の条件付きコメントは、対応しているすべてのブラウザで無視されます。 in /home/artws/woo-japan.info/public_html/wp-includes/functions.php on line 6131
コンテンツへスキップ →

naming-conventions

Table of Contents

Naming conventions

PHP

WooCommerce core generally follows WordPress PHP naming conventions. On top of that, function, class, and hook names should be prefixed. For functions the prefix is wc_, for classes is WC_ and for hooks is woocommerce_.

関数名の例:

  • wc_get_product()
  • wc_is_active_theme()

クラス名の例:

  • WC_Breadcrumb
  • WC_Cart

フック名の例(アクションまたはフィルター):

  • woocommerce_after_checkout_validation
  • woocommerce_get_formatted_order_total

There are however some exceptions which apply to classes defined inside src/. Within this directory:

  • We do not use the WC_ prefix for class names (the prefix is not needed, because all of the classes in this location live within the Automattic\WooCommerce namespace)
  • Classes are named using the CamelCase convention (however, method names should still be underscore_separated)
  • Class files should match the class name and do not need the class- prefix (for example, the filename for the StringUtil class is StringUtil.php)

JS

WooCommerce core follows WordPress JS naming conventions. As with PHP, function, class, and hook names should be prefixed, but the convention for JS is slightly different, and camelCase is used instead of snake_case. For functions, the prefix is wc, for classes is WC and for hooks is woocommerce.

関数名の例:

  • wcSettings()

クラス名の例:

  • WCOrdersTable

フック名の例(アクションまたはフィルター):

  • woocommerceTracksEventProperties

CSS and SASS

See CSS SASS coding guidelines and naming conventions.