好的,下面是发生的事情。使用Wordpress的Moneypress LE插件。我能够有效地通过文件"CSL-products_class.php"输出带有Div标签"buynow"的立即购买按钮的html。问题是通过我所附的样式表关联的样式将不会加载。
您可以通过检查其中一个产品来发现问题,同时查看我网站上的实时源代码http://www.dustinschmidt.com.html存在,但没有样式
添加了以下代码块:
$product_output[] = "<div class="{$this->css_prefix}-buynow">";
$product_output[] =
"<a href="{$product->web_urls[0]}" rel=nofollow target="cyber- sprocket-labs">".'</a>';
$product_output[] = '</div>';
以下是"CSL-products_class.php"现在的样子。
<?php
class wpCSL_products__mpcj {
function __construct($params) {
// Properties with default values
//
$this->columns = 1; // How many columns/row in our display output.
foreach ($params as $name => $value) {
$this->$name = $value;
}
}
/*-------------------------------------
* method: display_products
*
* Legacy Panhandler stuff that will eventually come out.
* This method generates the HTML that will be used to display
* the product list in WordPress when it renders the page.
*
*/
function display_products($products) {
$product_output[] = '';
$moneyFormat = get_option($this->prefix.'-money_format');
$linkModifiers = get_option($this->prefix.'-link_modifiers');
$currCol = 0;
foreach ($products as $product) {
// If we are on the first column, start a new row div
//
if ($currCol == 0) {
$product_output[] = '<div class="'.$this->css_prefix.'-row">';
}
$product_output[] = "<div class="{$this->css_prefix}-product">";
$product_output[] = "<h3>{$product->name}</h3>";
$product_output[] = "<div class="{$this->css_prefix}-left">";
$product_output[] = "<a href="{$product->web_urls[0]}" target="cyber-sprocket-labs" $linkModifiers>";
$product_output[] = "<img src="{$product->image_urls[0]}" alt="{$product->name}" title="{$product->name}" />";
$product_output[] = '</a><br/>';
$product_output[] = '<div class="'.$this->css_prefix.'-zoombox">';
$product_output[] = '<a class="thickbox" href="'.$product->image_urls[0].'"> </a>';
$product_output[] = '</div>';
$product_output[] = '</div>';
$product_output[] = '<div class="'.$this->css_prefix . '-right">';
$product_output[] = '<p class="' . $this->css_prefix . '-desc" >'.$product->description.'</p>';
$product_output[] = '<p class="' . $this->css_prefix . '-price">'.$product->currency;
if (function_exists('money_format') && ($moneyFormat != '')) {
$product_output[] =
"$ <a href="{$product->web_urls[0]}" rel=nofollow target="cyber-sprocket-labs" $linkModifiers>".
trim(money_format($moneyFormat, (float)$product->price)) .
'</a>';
} else {
$product_output[] =
"$ <a href="{$product->web_urls[0]}" rel=nofollow target="cyber-sprocket-labs">".
trim(number_format((float)$product->price, 2)) .
'</a>';
}
$product_output[] = '</p>';
$product_output[] = "<div class="{$this->css_prefix}-buynow">";
$product_output[] =
"<a href="{$product->web_urls[0]}" rel=nofollow target="cyber-sprocket-labs">".'</a>';
$product_output[] = '</div>';
$product_output[] = '</div>';
$product_output[] = '<div class="'.$this->css_prefix.'-cleanup"></div>';
$product_output[] = '</div>';
// Move to the next column, if we already hit the max desired
// output columns, close the row and get ready for a new one
//
$currCol++;
if ($currCol == $this->columns) {
$currCol = 0;
$product_output[] = '</div>';
}
}
// We did not end output on the last column
// so we need to close the row div
//
if ($currCol > 0) {
$currCol = 0;
$product_output[] = '</div>';
}
return implode($product_output);
}
}
最后是我的CSS fordiv标签"buynow"。
.csl_themes-buynow{background:url("../../core/images/buy-now.png") no-repeat;width:175px;height:64px;float:left}
感谢您的帮助,灰尘
通过转到http://www.dustinschmidt.com/watches/查看源代码,"csl_themes-bynow"类是几个div上的引用。例如。。。
<div class="csl_themes-buynow"><a href="http://www.anrdoezrs.net/click-5462802-10535303?url=http%3A%2F%2Fwww.ashford.com%2Fashford%2Fbrowse%2FproductDetail.jsp%3FproductId%3D96B139%26source%3D406010001&cjsku=96B139" rel=nofollow target="cyber-sprocket-labs"></a></div>
因此,在CSS中似乎有些设置不正确。
试着在CSS上加一个响亮的边框(类似于border: 10px solid limegreen
),看看它是否显示。。。