【问题标题】:Columns For Review Section Of Product Description产品描述审查部分的列
【发布时间】:2016-11-03 20:19:06
【问题描述】:

试图将我的产品描述的评论部分分成 2 列。它嵌套在产品描述的正下方。一列中的实际评论和旁边另一列中的“添加评论”表单。

网站是带有 Woocommerce 的 Wordpress。迄今为止,我已将评论移出标签,并位于产品描述下方。看这里https://www.boatpartsforless.com/shop/marpac-fuelwater-separator-filter-7-0860/。这样页面不会那么长,并且我感觉在我想在上面列中显示的评论中看起来更好。

我遇到了创建列 php 的代码

<?php
function my_multi_col($content) {

$columns = explode('<h2>', $content);
$i = 0;

foreach ($columns as $column) {
    if (($i % 2) == 0) {
        $return .= '<div class="content_left">'."\n";
        if ($i > 1) {
            $return .= "<h2>";
        } else {
            $return .= '<div class="content_right">'."\n <h2>";
        }
        $return .= $column;
        $return .= '</p></div>';
        $i++;
    }
    if(isset($columns[1])) {
            $content = wpautop($return);
    } else {
            $content = wpautop($content);
    }
    echo $content;
}
}
add_filter('the_content', 'my_multi_col');
?>

我相信将它添加到 single-product-reviews.php 文件中就可以了,只是不知道用什么替换 h2。

或者,如果我完全不在此列,这是一种有意义的方式。

我们将不胜感激任何朝着正确方向的推动。

【问题讨论】:

    标签: php css wordpress woocommerce e-commerce


    【解决方案1】:

    想通了。变得困难重重。用样式表中的 CSS 做到这一点。

    /* Reviews In Columns */
    
    #reviews #comments ol.commentlist {
    float: right !important;
    width: 60% !important;
    }
    
    #reviews #review_form_wrapper {
    margin-top: 0 !important;
    float: left !important;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-29
      • 1970-01-01
      • 1970-01-01
      • 2020-10-21
      • 2018-07-27
      • 1970-01-01
      相关资源
      最近更新 更多