所以我已经让magento 2正常运行,我甚至开始自己的主题,但我已经尝试在安装magento之后安装示例数据.它在终端中返回了"区号未设置:",下面是我的步骤.
bin/magento sampledata:deploy
composer update
Run Code Online (Sandbox Code Playgroud)
哪个回报:
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing magento/module-catalog-sample-data (100.0.3)
Downloading: 100%
- Installing magento/module-bundle-sample-data (100.0.3)
Downloading: 100%
- Installing magento/module-widget-sample-data (100.0.3)
Downloading: 100%
- Installing magento/module-customer-sample-data (100.0.3)
Downloading: 100%
- Installing magento/sample-data-media (100.0.3)
Downloading: 100%
- Installing magento/module-theme-sample-data (100.0.3)
Downloading: 100%
- Installing magento/module-cms-sample-data (100.0.3)
Downloading: 100%
- Installing magento/module-catalog-rule-sample-data (100.0.3)
Downloading: 100%
- Installing magento/module-sales-rule-sample-data (100.0.3)
Downloading: 100%
- Installing magento/module-review-sample-data (100.0.3)
Downloading: 100%
- Installing magento/module-tax-sample-data …Run Code Online (Sandbox Code Playgroud) 我目前有一个自定义帖子类型的wordpress和附加到它的自定义分类.(jobs_category).
我的构建列出了这个分类中的类别,如下所示:
<?php
$taxonomy = 'jobs_category';
$tax_terms = get_terms($taxonomy);
?>
<ul>
<?php
foreach ($tax_terms as $tax_term) {?>
<li id="cat-<?php echo $tax_term->term_id; ?>">
<a href="#<?php //echo esc_attr(get_term_link($tax_term, $taxonomy)); ?>" class="<?php echo $tax_term->slug; ?> ajax" onclick="cat_ajax_get('<?php echo $tax_term->term_id; ?>');" title="<?php echo $tax_term->name;?>"><?php echo $tax_term->name; ?></a>
</li>
<? } ?>
</ul>
Run Code Online (Sandbox Code Playgroud)
然后我在我的函数文件中使用了以下内容:
add_action( 'wp_ajax_nopriv_load-filter', 'prefix_load_cat_posts' );
add_action( 'wp_ajax_load-filter', 'prefix_load_cat_posts' );
function prefix_load_cat_posts () {
$cat_id = $_POST[ 'cat' ];
$args = array (
'cat' => $cat_id,
'posts_per_page' => 10,
'order' => 'DESC'
); …Run Code Online (Sandbox Code Playgroud) php ×2
ajax ×1
composer-php ×1
javascript ×1
jquery ×1
magento ×1
magento-2.0 ×1
magento2 ×1
wordpress ×1