2017-03-03 27 views
2

我讀過以前的線程關於wooCommerce明星問題,並沒有能夠幫助自己解決這個問題。我對任何裁員表示歉意。我是一名老師,也是新來的css。這是我的問題:WooCommerce明星符號顯示爲框圖標

我使用Mystile主題爲我的網站k12movieguides.com,我梳理了我style.css文件的wooCommerce部分。我在各個產品頁面和評論區域獲得了星星的正常工作,但我無法弄清楚如何讓星星出現在商店和主頁上的產品縮略圖下,其中每個產品旁邊有多個產品。我不用星星,而是看到一個通用的盒子圖標。

Here is a screenshot of the box icons, I've tried to use chrome's inspect feature to figure out what is going wrong with class="rating" but I can't figure it out.

這裏是我的下WooCommerce部分style.css中的全部代碼。請讓我知道是否需要其他信息來幫助解決這個問題。你的時間和天才非常感謝。

/*-------------------------------------------------------------------------------------------*/ 
 
/* 7. WOOCOMMERCE */ 
 
/*-------------------------------------------------------------------------------------------*/ 
 
p.demo_store { 
 
    background: #4d65a4; 
 
    position: fixed; 
 
    top: 0; 
 
    left: 0; 
 
    right: 0; 
 
    text-align: center; 
 
    color: #fff; 
 
    padding: 1em; 
 
} 
 
.homepage-banner { 
 
    display: none; 
 
} 
 

 

 
/* ========================================================================== 
 
\t Snippet Name: WooCommerce Review Star Ratings 
 
\t Description: This css snippet blends all woocommerce star rating for a consistant look sitewide. Consolidates code and makes uses of WooCommerce.eot font. If you disabled the woocommerce.css and built your own styles then this will work great. If you are overriding woocommerce.css by adding styles to another styesheet that loads afterwards, this will still work fine, but you may need to target specific elements or create a master reset targeting all elements listed below in order to remove some of woocommerce default margins and padding. 
 
\t Author:  GL Walker 
 
\t Author URI: http://wsfive.com 
 
    ========================================================================== */ 
 

 

 
.woocommerce .star-rating, .woocommerce p.stars [class^="star-"], .woocommerce p.stars [class*=" star-"] { 
 
\t font-family: WooCommerce; 
 
\t speak: none; 
 
\t font-weight: 400; 
 
\t font-variant: normal; 
 
\t text-transform: none; 
 
\t line-height: 1; 
 
\t -webkit-font-smoothing: antialiased; 
 
\t font-size: 1em; 
 
} 
 
.woocommerce .star-rating { 
 
\t overflow: hidden; 
 
\t position: relative; 
 
\t height: 1em; 
 
\t width: 5em; 
 
} 
 
.woocommerce .star-rating:before { 
 
\t content: "\e021\e021\e021\e021\e021"; 
 
\t float: left; 
 
\t top: 0; 
 
\t left: 0; 
 
\t position: absolute; 
 
\t color: #999; 
 
} 
 
.woocommerce .star-rating span { 
 
\t overflow: hidden; 
 
\t float: left; 
 
\t top: 0; 
 
\t left: 0; 
 
\t position: absolute; 
 
\t padding-top: 1.5em 
 
} 
 
.woocommerce .star-rating span:before { 
 
\t content: "\e020\e020\e020\e020\e020"; 
 
\t top: 0; 
 
\t position: absolute; 
 
\t left: 0; 
 
\t color: #F90; 
 
} 
 
/* rating block specific to single product summary area */ 
 
.woocommerce .woocommerce-product-rating { 
 
\t display: block; 
 
\t width: 100%; 
 
} 
 
.woocommerce .woocommerce-product-rating .star-rating { 
 
\t margin: 0 auto; 
 
\t float: left; 
 
\t font-size: 1em; 
 
} 
 
.woocommerce .woocommerce-product-rating .woocommerce-review-link { 
 
\t font-size: 85%; 
 
\t width: 100%; 
 
\t margin: 0.5em 0; 
 
\t float: left; 
 
} 
 
/* rating block specific to review submit form */ 
 
.woocommerce p.stars { 
 
\t position: relative; 
 
\t padding: 0.75em; 
 
} 
 
.woocommerce p.stars a { 
 
\t display: inline-block; 
 
\t margin-right: 1em; 
 
\t text-indent: -9999px; 
 
\t position: relative; 
 
\t border-bottom: 0!important; 
 
\t outline: 0; 
 
\t color: #999; 
 
} 
 
.woocommerce p.stars a:hover, .woocommerce p.stars a.active { 
 
\t color: #F90; 
 
} 
 
.woocommerce p.stars a:last-child { 
 
\t border-right: 0 
 
} 
 
.woocommerce p.stars [class^="star-"], .woocommerce p.stars [class*=" star-"] { 
 
\t border-right: 1px solid #ccc 
 
} 
 
.woocommerce p.stars [class^="star-"]:after, .woocommerce p.stars [class*=" star-"]:after { 
 
\t text-indent: 0; 
 
\t position: absolute; 
 
\t top: 0; 
 
\t left: 0 
 
} 
 
.woocommerce p.stars a.star-1 { 
 
\t width: 2em 
 
} 
 
.woocommerce p.stars a.star-1:after { 
 
\t content: "\e021" 
 
} 
 
.woocommerce p.stars a.star-1.active:after, .woocommerce p.stars a.star-1:hover:after { 
 
\t content: "\e020" 
 
} 
 
.woocommerce p.stars a.star-2 { 
 
\t width: 3em 
 
} 
 
.woocommerce p.stars a.star-2:after { 
 
\t content: "\e021\e021" 
 
} 
 
.woocommerce p.stars a.star-2.active:after, .woocommerce p.stars a.star-2:hover:after { 
 
\t content: "\e020\e020" 
 
} 
 
.woocommerce p.stars a.star-3 { 
 
\t width: 4em 
 
} 
 
.woocommerce p.stars a.star-3:after { 
 
\t content: "\e021\e021\e021" 
 
} 
 
.woocommerce p.stars a.star-3.active:after, .woocommerce p.stars a.star-3:hover:after { 
 
\t content: "\e020\e020\e020" 
 
} 
 
.woocommerce p.stars a.star-4 { 
 
\t width: 5em 
 
} 
 
.woocommerce p.stars a.star-4:after { 
 
\t content: "\e021\e021\e021\e021" 
 
} 
 
.woocommerce p.stars a.star-4.active:after, .woocommerce p.stars a.star-4:hover:after { 
 
\t content: "\e020\e020\e020\e020" 
 
} 
 
.woocommerce p.stars a.star-5 { 
 
\t width: 6em; 
 
} 
 
.woocommerce p.stars a.star-5:after { 
 
\t content: "\e021\e021\e021\e021\e021" 
 
} 
 
.woocommerce p.stars a.star-5.active:after, .woocommerce p.stars a.star-5:hover:after { 
 
\t content: "\e020\e020\e020\e020\e020" 
 
} 
 
/* rating block specific to product listing */ 
 
.woocommerce ul.products li.product .star-rating { 
 
\t display: block; 
 
\t text-align: center; 
 
\t margin: 0 auto; 
 
} 
 
/* rating block specific to sidebar widgets */ 
 
.woocommerce ul.cart_list li .star-rating, .woocommerce ul.product_list_widget li .star-rating { 
 
\t display: block; 
 
\t text-align: center; 
 
\t margin: 0 auto; 
 
} 
 
/* end of review stars */ 
 

 

 

 
div.quantity { 
 
    white-space: nowrap; 
 
    /* Disable input[type=number] buttons until the world is ready */ 
 
} 
 
div.quantity input::-webkit-outer-spin-button, 
 
div.quantity input::-webkit-inner-spin-button { 
 
    display: none; 
 
} 
 
div.quantity .plus, 
 
div.quantity .minus { 
 
    font-family: 'WooCommerce'; 
 
    background: none; 
 
    border: none; 
 
    font-size: 1.387em; 
 
    padding: 0; 
 
    color: #ff4800; 
 
    -webkit-transition: all ease-in-out 0.2s; 
 
    -moz-transition: all ease-in-out 0.2s; 
 
    -ms-transition: all ease-in-out 0.2s; 
 
    -o-transition: all ease-in-out 0.2s; 
 
    transition: all ease-in-out 0.2s; 
 
} 
 
div.quantity .plus:hover, 
 
div.quantity .minus:hover { 
 
    color: #dd2600; 
 
} 
 
div.quantity .qty { 
 
    margin: 0 .618em; 
 
    width: 2.618em; 
 
    text-align: center; 
 
    padding-left: 0; 
 
    padding-right: 0; 
 
} 
 
table div.quantity { 
 
    font-size: .857em; 
 
} 
 
.single-product div.quantity { 
 
    float: left; 
 
    margin-right: 1.618em; 
 
    border-right: 4px double #e8e4e3; 
 
    padding-right: 1.618em; 
 
} 
 
.single-product table div.quantity { 
 
    padding-right: 0; 
 
    border: 0; 
 
} 
 
.single-product #reviews .star-rating { 
 
    float: right; 
 
} 
 
.single-product .single_variation .price { 
 
    display: block; 
 
    margin-bottom: .618em; 
 
} 
 
dl.variation dt, 
 
dl.variation dd { 
 
    float: left; 
 
} 
 
dl.variation dt { 
 
    clear: left; 
 
    margin-right: .53em; 
 
} 
 
dl.variation dd ul { 
 
    list-style: none; 
 
} 
 
.backorder_notification { 
 
    clear: both; 
 
} 
 
.validate-required.woocommerce-validated input { 
 
    border-color: #84ac50; 
 
    background: #e5eeda; 
 
} 
 
.validate-required.woocommerce-invalid input { 
 
    border-color: #b85f56; 
 
    background: #f4e7e6; 
 
}

+0

只要懇求社區,如果任何人可以提供任何意見或建議,將不勝感激。我一直在搞這些代碼,並在過去的兩週裏在互聯網上尋找類似的帖子,但無法弄清楚。非常感謝:) – TeacherTravis

回答

0

我有一個非常類似的問題,但我能夠輸出S的,但他們無法格式化成恆星。查看我發佈的問題,因爲它們可能會對您有所幫助。以下是我使用的一些代碼。請原諒我的一些評論。我一直工作在這整整一個星期笑

/*--------------------------------------*/ 
/* MAKES LEAVE A REVIEW WORK PERFECTLY! */ 
/* Copied from plugins-woocommerce-assets-css-woocommerce.ss */ 
/*--------------------------------------*/ 
.woocommerce p.stars a:before,.woocommerce p.stars a:hover~a:before{content:"\e021"}.woocommerce #review_form #respond p{margin:0 0 10px}.woocommerce #review_form #respond .form-submit input{left:auto}.woocommerce #review_form #respond textarea{box-sizing:border-box;width:100%}.woocommerce p.stars a{position:relative;height:1em;width:1em;text-indent:-999em;display:inline-block;text-decoration:none}.woocommerce p.stars a:before{display:block;position:absolute;top:0;left:0;width:1em;height:1em;line-height:1;font-family:WooCommerce;text-indent:0}.woocommerce table.shop_attributes td,.woocommerce table.shop_attributes th{line-height:1.5;border-bottom:1px dotted rgba(0,0,0,.1);border-top:0;margin:0}.woocommerce p.stars.selected a.active:before,.woocommerce p.stars:hover a:before{content:"\e020"}.woocommerce p.stars.selected a.active~a:before{content:"\e021"}.woocommerce p.stars.selected a:not(.active):before{content:"\e020"} 


/*--------------------------------------*/ 
/* STAR RATINGS!! EEEEYYYY!! */ 
/*--------------------------------------*/ 
/* COULD POSSIBLY BE FORCING S's on SHOP PAGE! When removed, all ratings change to numerical "4 out of 5". But when above taken from woocommerce.css then Add a review section works fine */ 

/* Adds some space between top avg review and product price */ 
.woocommerce div.product .woocommerce-product-rating { 
    margin-bottom: 1.618em; 
} 


/* Deleting made no changes to Product OR Shop page stars */ 
/*.woocommerce .woocommerce-product-rating:after, .woocommerce .woocommerce-product-rating:before { 
    content: " "; 
    display: table; 
}*/ 

/* Deleting made no changes to Product OR Shop page stars */ 
/*.woocommerce .woocommerce-product-rating .star-rating { 
    margin: .5em 4px 0 0; 
    float: left; 
}*/ 


/* Fills in posted review's star's on product page and removes "# out of # based on customer reviews" from top of product page next to avg stars & removes "# out of # from shop page and aligns S's */ 
.woocommerce .star-rating { 
    float: right; 
    overflow: hidden; 
    position: relative; 
    height: 1em; 
    line-height: 1; 
    font-size: 1em; 
    width: 5.4em; 
} 

/* Adds empty stars behind user submitted star ratings & grey s's to shop page */ 
.woocommerce .star-rating:before { 
    content: "\73\73\73\73\73"; 
    color: #d3ced2; 
    float: left; 
    top: 0; 
    left: 0; 
    position: absolute; 
    font-family: star; 
} 

/* Changes product page black stars to blue and removes previous "# out of #" text & removes "# out of # from Shop page*/ 
.woocommerce .star-rating span { 
    overflow: hidden; 
    float: left; 
    top: 0; 
    left: 0; 
    position: absolute; 
    padding-top: 1.5em; 
    font-family = "star"; 
    color: #52a0cd; 
} 

/* Fills in product page review stars and avg star ratings appropriately based on posted reviews & Add's uppercase blue S's to Shop page */ 
.woocommerce .star-rating span:before { 
    content: "\53\53\53\53\53"; 
    top: 0; 
    position: absolute; 
    left: 0; 
    font-family: star; 
    visibility: visible; 
    font-family: star; 
} 
+0

我知道你的痛苦。就在今天,我下載了YOTPO評論插件,我想我會堅持這一點。至少在免費版本中,它只顯示每個產品頁面上的評分星。我原來的帖子主要是讓我的商店頁面上的每個產品下都出現明星,而且這個插件很容易實現。如果你有興趣,這是它的樣子。 http://k12movieguides.com/product/trolls-movie-guide/ – TeacherTravis

0

這是此錯誤的解決方法,而不是它的解決方案,但它可能是一個有益的臨時墊片,直到有人更聰明的人物了真正的答案。

使用FontAwesome圖標集,您可以使用它們的星代替缺失的星。

一旦FontAwesome已成功安裝,以下是必要的CSS。

/* Base */ 
p.stars.selected a.active~a:before, 
p.stars:hover a:before, 
p.stars a:before, 
p.stars a:hover~a:before, 
p.stars.selected a:not(.active):before, 
p.stars.selected a.active:before { 
font-family: fontawesome; 
} 

/* Empty Stars */ 
p.stars a:before, 
p.stars a:hover~a:before, 
p.stars.selected a.active~a:before { 
    content: "\f006"; 
} 

/* Filled Stars */ 
p.stars:hover a:before, 
p.stars.selected a:not(.active):before, 
p.stars.selected a.active:before { 
    content: "\f005"; 
}