Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php WooCommerce产品有';产品形象';但是没有';特色图片';_Php_Wordpress_Wordpress Theming_Woocommerce - Fatal编程技术网

Php WooCommerce产品有';产品形象';但是没有';特色图片';

Php WooCommerce产品有';产品形象';但是没有';特色图片';,php,wordpress,wordpress-theming,woocommerce,Php,Wordpress,Wordpress Theming,Woocommerce,我正在使用带有自定义主题的WooCommerce 2.1.3。自定义主题从页面中获取“特色图像”,并使用它来拉伸和显示标题图像(一些jQuery内容)。重点是,WooCommerce使用的是“产品形象”,而不是“特色形象”。我假设这就是为什么我的主题没有拾取照片并将其用于标题图像的原因。。。。标题保持空白。是否要将此“特色图像”重新添加到产品中?通过这种方式,它们将类似的属性归于常规页面 谢谢 更新: 这是包含jQuery的PHP文件。该文件名为page-title-progression.ph

我正在使用带有自定义主题的WooCommerce 2.1.3。自定义主题从页面中获取“特色图像”,并使用它来拉伸和显示标题图像(一些jQuery内容)。重点是,WooCommerce使用的是“产品形象”,而不是“特色形象”。我假设这就是为什么我的主题没有拾取照片并将其用于标题图像的原因。。。。标题保持空白。是否要将此“特色图像”重新添加到产品中?通过这种方式,它们将类似的属性归于常规页面

谢谢

更新:

这是包含jQuery的PHP文件。该文件名为page-title-progression.php

<?php if(is_404() ): ?>
    <div id="page-title">
        <div class="width-container paged-title">
            <h1 class="page-title"><?php _e( '404 Page Not Found ', 'progression' ); ?></h1>
        </div>
        <div id="page-title-divider"></div>
    </div><!-- #page-title -->
    <div class="clearfix"></div>
    <?php $page_for_posts = get_option('page_for_posts'); ?>
    <?php if(has_post_thumbnail($page_for_posts)): ?>
        <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($page_for_posts), 'progression-page-title'); ?>
        <script type='text/javascript'>

        jQuery(document).ready(function($) {  
            $("#page-title").backstretch([
                "<?php echo $image[0]; ?>"
                <?php if( class_exists( 'kdMultipleFeaturedImages' ) ) {
                    if( kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) != "" ) {
                        echo ',"', kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) , '"';
                    }

                    if( kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) != "" ) {
                        echo ',"', kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) , '"';
                    }
                }
                ?>
            ],{
                    fade: 750,
                    duration: <?php echo of_get_option('slider_autoplay', 8000); ?>
             });
        });

        </script>
    <?php endif; ?>
<?php else: ?>

    <?php if(is_page()): ?>
        <?php
        global $wp_query;
        $thePostID = $wp_query->post->ID;
        ?>
        <div id="page-title">
            <div class="width-container paged-title">
                <h1><?php the_title(); ?></h1>  
            </div>
        <div id="page-title-divider"></div>
        </div><!-- #page-title -->
        <div class="clearfix"></div>
        <?php if(has_post_thumbnail()): ?>
            <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'progression-page-title'); ?>
            <script type='text/javascript'>
            jQuery(document).ready(function($) {  
                $("#page-title").backstretch([
                    "<?php echo $image[0]; ?>"
                    <?php if( class_exists( 'kdMultipleFeaturedImages' ) ) {
                        if( kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) , '"';
                        }

                        if( kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) , '"';
                        }
                    }
                    ?>
                ],{
                        fade: 750,
                        duration: <?php echo of_get_option('slider_autoplay', 8000); ?>
                 });
            });
            </script>
        <?php endif; ?>
    <?php endif; ?>

    <?php if(is_home() || is_single() && 'portfolio' != get_post_type() && 'menu' != get_post_type() ): ?>
        <div id="page-title">
            <div class="width-container paged-title">
                <?php $page_for_posts = get_option('page_for_posts'); ?>
                <h1 class="page-title"><?php echo get_the_title($page_for_posts); ?></h1>
            </div>
        <div id="page-title-divider"></div>
        </div><!-- #page-title -->
        <div class="clearfix"></div>
        <?php if(has_post_thumbnail($page_for_posts)): ?>
            <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($page_for_posts), 'progression-page-title'); ?>
            <script type='text/javascript'>

            jQuery(document).ready(function($) {  
                $("#page-title").backstretch([
                    "<?php echo $image[0]; ?>"
                    <?php if( class_exists( 'kdMultipleFeaturedImages' ) ) {
                        if( kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) , '"';
                        }

                        if( kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) , '"';
                        }
                    }
                    ?>
                ],{
                        fade: 750,
                        duration: <?php echo of_get_option('slider_autoplay', 8000); ?>
                 });
            });

            </script>
        <?php endif; ?>
    <?php endif; ?>

    <?php if(is_archive() ): ?>
        <div id="page-title">
            <div class="width-container paged-title">
                <h1 class="page-title">
                    <?php if ( is_day() ) : ?>
                    <?php printf( __( 'Archives: %s', 'progression' ), '<span>' . get_the_date() . '</span>' ); ?>
                    <?php elseif ( is_month() ) : ?>
                        <?php printf( __( 'Archives: %s', 'progression' ), '<span>' . get_the_date( 'F Y' ) . '</span>' ); ?>
                    <?php elseif ( is_year() ) : ?>
                        <?php printf( __( 'Archives: %s', 'progression' ), '<span>' . get_the_date( 'Y' ) . '</span>' ); ?>
                    <?php endif; ?>
                    <?php if ( is_tag() ) : ?>
                        <?php
                            printf( __( 'Tag: %s', 'progression' ), '<span>' . single_tag_title( '', false ) . '</span>' );
                        ?>
                    <?php endif; ?>
                    <?php if ( is_author() ) : ?>
                        <?php _e( 'Author Archives:', 'progression' ); ?>
                        <?php $user_info = get_userdata(1);
                              echo '' . $user_info->display_name . "\n";
                        ?>
                    <?php endif; ?>
                    <?php if(post_type_exists('menu') ) : ?>
                        <?php
                            printf( __( '%s', 'progression' ), '<span>' . single_cat_title( '', false ) . '</span>' );
                        ?>
                    <?php endif; ?>
                    </h1>
                </div>
            <div id="page-title-divider"></div>
        </div><!-- #page-title -->
        <div class="clearfix"></div>
        <?php $page_for_posts = get_option('page_for_posts'); ?>
        <?php if(has_post_thumbnail($page_for_posts)): ?>
            <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($page_for_posts), 'progression-page-title'); ?>
            <script type='text/javascript'>

            jQuery(document).ready(function($) {  
                $("#page-title").backstretch([
                    "<?php echo $image[0]; ?>"
                    <?php if( class_exists( 'kdMultipleFeaturedImages' ) ) {
                        if( kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) , '"';
                        }

                        if( kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) , '"';
                        }
                    }
                    ?>
                ],{
                        fade: 750,
                        duration: <?php echo of_get_option('slider_autoplay', 8000); ?>
                 });
            });

            </script>
        <?php endif; ?>

    <?php endif; ?>

    <?php if(is_search() ): ?>
        <div id="page-title">
            <div class="width-container paged-title">
                <h1 class="page-title"><?php printf( __( 'Search for: %s', 'progression' ), '<span>' . get_search_query() . '</span>' ); ?></h1></div>
        <div id="page-title-divider"></div>

        </div><!-- #page-title -->
        <div class="clearfix"></div>
        <?php $page_for_posts = get_option('page_for_posts'); ?>
        <?php if(has_post_thumbnail($page_for_posts)): ?>
            <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($page_for_posts), 'progression-page-title'); ?>
            <script type='text/javascript'>

            jQuery(document).ready(function($) {  
                $("#page-title").backstretch([
                    "<?php echo $image[0]; ?>"
                    <?php if( class_exists( 'kdMultipleFeaturedImages' ) ) {
                        if( kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) , '"';
                        }

                        if( kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) , '"';
                        }
                    }
                    ?>
                ],{
                        fade: 750,
                        duration: <?php echo of_get_option('slider_autoplay', 8000); ?>
                 });
            });

            </script>
        <?php endif; ?>
    <?php endif; ?>

    <?php if(is_single() && 'portfolio' == get_post_type() ): ?>
        <div id="page-title">
            <div class="width-container paged-title">
                <h1><?php the_title(); ?></h1>  
            </div>
        <div id="page-title-divider"></div>
        </div><!-- #page-title -->
        <div class="clearfix"></div>
        <?php $page_for_posts = get_option('page_for_posts'); ?>
        <?php if(has_post_thumbnail($page_for_posts)): ?>
            <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($page_for_posts), 'progression-page-title'); ?>
            <script type='text/javascript'>

            jQuery(document).ready(function($) {  
                $("#page-title").backstretch([
                    "<?php echo $image[0]; ?>"
                    <?php if( class_exists( 'kdMultipleFeaturedImages' ) ) {
                        if( kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) , '"';
                        }

                        if( kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) , '"';
                        }
                    }
                    ?>
                ],{
                        fade: 750,
                        duration: <?php echo of_get_option('slider_autoplay', 8000); ?>
                 });
            });

            </script>
        <?php endif; ?>
    <?php endif; ?>



    <?php if(is_single() && 'menu' == get_post_type() ): ?>
        <div id="page-title">
            <div class="width-container paged-title">
                <h1><?php the_title(); ?></h1>  
            </div>
        <div id="page-title-divider"></div>
        </div><!-- #page-title -->
        <div class="clearfix"></div>
        <?php $page_for_posts = get_option('page_for_posts'); ?>
        <?php if(has_post_thumbnail($page_for_posts)): ?>
            <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($page_for_posts), 'progression-page-title'); ?>
            <script type='text/javascript'>

            jQuery(document).ready(function($) {  
                $("#page-title").backstretch([
                    "<?php echo $image[0]; ?>"
                    <?php if( class_exists( 'kdMultipleFeaturedImages' ) ) {
                        if( kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-2', 'page', 'progression-page-title', $thePostID ) , '"';
                        }

                        if( kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) != "" ) {
                            echo ',"', kd_mfi_get_featured_image_url( 'featured-image-3', 'page', 'progression-page-title', $thePostID ) , '"';
                        }
                    }
                    ?>
                ],{
                        fade: 750,
                        duration: <?php echo of_get_option('slider_autoplay', 8000); ?>
                 });
            });

            </script>
        <?php endif; ?>
    <?php endif; ?>

<?php endif; ?>

jQuery(文档).ready(函数($){
$(“#页面标题”).backstretch([
""
],{
衰减:750,
持续时间:
});
});
jQuery(文档).ready(函数($){
$(“#页面标题”).backstretch([
""
],{
衰减:750,
持续时间:
});
});
jQuery(文档).ready(函数($){
$(“#页面标题”).backstretch([
""
],{
衰减:750,
持续时间:
});
});
jQuery(文档).ready(函数($){
$(“#页面标题”).backstretch([
""

只需要为产品页面创建一个新的if语句:

WooCommerce仍然使用特色图片,只需将界面中的文本更改为“产品图片”你能发布你正在使用的查询代码吗?我添加了上面的代码。除了产品页面之外,它在其他任何地方都有效。我甚至试着从我知道有效的模板复制PHP代码(到单个产品页面,这是woocommerce用于显示单个产品的页面模板)它仍然不会显示标题图像。这让我抓狂。谢谢!我假设我需要添加一个新的if语句来识别产品页面。这只是一个猜测。想法?如果这确实正确,那么您可能知道如何进行if调用?