"抱歉,没有符合条件的帖子" WooCommerce Shortcodes

时间:2017-01-07 16:49:15

标签: php wordpress woocommerce

我有一个自定义的WordPress主题,它给我带来了WooCommerce短代码的轻微错误。我创建了"我的帐户," "车"和"结帐"页面。他们一开始工作正常,并显示正确的内容。我最终决定改变我的主题名称(我最初想在不同的域名上设置商店,但改变了我的想法并转而使用另一个域名)。我到处改变了所有旧名称的实例。

现在,每当我访问上述任何一个页面时,我只会得到一个"抱歉,没有符合您条件的帖子"消息(系统从我的index.php页面中提取)。我已将主题与Woocommerce整合如下:

// Declare WooCommerce Support
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
    add_theme_support( 'woocommerce' );
}


remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);

add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);

function my_theme_wrapper_start() {
  echo '<div id="content">';
}

function my_theme_wrapper_end() {
  echo '</div>';
}

我希望自己得到正确的评价,因为我对此非常不确定。我的标记如下:

<div id="wrapper">
    <div id="header"></div>
    <div id="content"></div>
    <div id="footer"></div>
</div>

所以我认为这是对的。我不认为问题是主题与WooCommerce的整合。

这是我的状态报告,如果有帮助的话:

`### WordPress Environment ###

    Home URL: http://www.websiteurl.com
    Site URL: http://www.websiteurl.com
    WC Version: 2.6.11
    Log Directory Writable: ✔
    WP Version: 4.7
    WP Multisite: –
    WP Memory Limit: 168 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US

    ### Server Environment ###

    Server Info: Apache
    PHP Version: ❌ 5.4.35 - We recommend a minimum PHP version of 5.6. See: How to update your PHP version
    PHP Post Max Size: 32 MB
    PHP Time Limit: 60
    PHP Max Input Vars: 1000
    cURL Version: 7.38.0
    OpenSSL/1.0.1e

    SUHOSIN Installed: ✔
    MySQL Version: ❌ 5.5.52 - We recommend a minimum MySQL version of 5.6. See: WordPress Requirements
    Max Upload Size: 32 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔

    ### Database ###

    WC Database Version: 2.6.11
    : 
    woocommerce_sessions: ✔
    woocommerce_api_keys: ✔
    woocommerce_attribute_taxonomies: ✔
    woocommerce_downloadable_product_permissions: ✔
    woocommerce_order_items: ✔
    woocommerce_order_itemmeta: ✔
    woocommerce_tax_rates: ✔
    woocommerce_tax_rate_locations: ✔
    woocommerce_shipping_zones: ✔
    woocommerce_shipping_zone_locations: ✔
    woocommerce_shipping_zone_methods: ✔
    woocommerce_payment_tokens: ✔
    woocommerce_payment_tokenmeta: ✔
    MaxMind GeoIP Database: ✔

    ### Active Plugins (10) ###

    Envato Market: by Derek Herman – 1.0.0-RC2
    WooThumbs - Awesome Product Imagery: by Iconic – 4.6.1
    Jetpack by WordPress.com: by Automattic – 4.4.2
    Maintenance Mode: by Lukas Juhas – 2.2.2
    Max Mega Menu: by Tom Hemsley – 2.3.3
    Slider Revolution Particles Effect: by ThemePunch – 1.0.1
    Slider Revolution: by ThemePunch – 5.3.1.5
    WooSwatches - Woocommerce Color or Image Variation Swatches: by parbat chaudhari – 2.2.7
    WooCommerce: by WooThemes – 2.6.11
    YITH WooCommerce Wishlist: by YITHEMES – 2.0.16

    ### Settings ###

    Force SSL: –
    Currency: GBP (£)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2

    ### API ###

    API Enabled: ✔

    ### WC Pages ###

    Shop Base: ❌ Page not set
    Cart: #1489 - /my-bag/
    Checkout: #1424 - /checkout/
    My Account: #1426 - /my-account/

    ### Taxonomies ###

    Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)


    ### Theme ###

    Name: Site Theme
    Version: 1.0
    Author URL: http://www.site-theme.com/
    Child Theme: ❌ – If you're modifying WooCommerce on a parent theme you didn't build personally
    then we recommend using a child theme. See: How to create a child theme

    WooCommerce Support: ✔

    ### Templates ###

    Overrides: MySite/woocommerce/archive-product.php
    MySite/woocommerce/cart/cart.php
    MySite/woocommerce/cart/mini-cart.php
    MySite/woocommerce/content-single-product.php
    MySite/woocommerce/global/quantity-input.php
    MySite/woocommerce/loop/sale-flash.php
    MySite/woocommerce/single-product/add-to-cart/variable.php
    MySite/woocommerce/single-product/price.php
    MySite/woocommerce/single-product/sale-flash.php
    MySite/woocommerce/single-product/short-description.php
    MySite/woocommerce/single-product/tabs/tabs.php

在我更改主题名称之前,昨晚一切正常。

有什么想法吗?我想我一定忽视了一些事情。非常感谢!

更新:我切换主题并且问题仍然存在,因此罪魁祸首必须是别的。

更新2:我在我创建的所有页面上都收到404 Not Found错误,但主页,存档和产品页面除外。但是我创建的任何新页面都会出现同样的情况。

1 个答案:

答案 0 :(得分:0)

好的,回答我自己的问题,问题实际上是永久链接的设置方式。对于产品,我将它们设置为/%product_cat%,导致其他页面出现404 Not Found错误。我将产品固定链接恢复为/shop/%product_cat%,现在一切正常。

谢谢!