在列中显示产品插件(Woocommerce)

时间:2017-09-25 20:43:17

标签: php woocommerce custom-wordpress-pages woocommerce-theming

我在Woocommerce中使用产品插件。不幸的是,使用当前的功能,每个新的插件都会追求另一个。就像这样:

Addon 1

Addon 2

依旧......

您可以访问此处的链接enter link description here

现在,我想要做的是:

每当有多个添加时,它应遵循以下布局:

Addon 1 | Addon 2

Addon 3 | Addon 4

Addon 5

依旧......

以下是插件的现有代码



<div class="<?php if ( 1 == $required ) echo 'required-product-addon'; ?> product-addon product-addon-<?php echo sanitize_title( $name ); ?>">

	<?php do_action( 'wc_product_addon_start', $addon ); ?>

	<?php if ( $name ) : ?>
		<h3 class="addon-name"><?php echo wptexturize( $name ); ?> <?php if ( 1 == $required ) echo '<abbr class="required" title="' . __( 'Required field', 'woocommerce-product-addons' ) . '">*</abbr>'; ?></h3>
	<?php endif; ?>

	<?php if ( $description ) : ?>
		<?php echo '<div class="addon-description">' . wpautop( wptexturize( $description ) ) . '</div>'; ?>
	<?php endif; ?>

	<?php do_action( 'wc_product_addon_options', $addon ); ?>
&#13;
&#13;
&#13;

请帮忙!

以下是我对PHP的一点知识所尝试的内容:

&#13;
&#13;
<div class="su-row">
<div class="su-column su-column-size-1-2"><div class="su-column-inner su-clearfix">
<div class="<?php if ( 1 == $required ) echo 'required-product-addon'; ?> product-addon product-addon-<?php echo sanitize_title( $name ); ?>">

	<?php do_action( 'wc_product_addon_start', $addon ); ?>

	<?php if ( $name ) : ?>
		<h3 class="addon-name"><?php echo wptexturize( $name ); ?> <?php if ( 1 == $required ) echo '<abbr class="required" title="' . __( 'Required field', 'woocommerce-product-addons' ) . '">*</abbr>'; ?></h3>
	<?php endif; ?>

	<?php if ( $description ) : ?>
		<?php echo '<div class="addon-description">' . wpautop( wptexturize( $description ) ) . '</div>'; ?>
	<?php endif; ?>

	<?php do_action( 'wc_product_addon_options', $addon ); ?>
</div></div>
<div class="su-column su-column-size-1-2"><div class="su-column-inner su-clearfix">
<? php if (i+1 == $addon) ?>
<div class="<?php if ( 1 == $required ) echo 'required-product-addon'; ?> product-addon product-addon-<?php echo sanitize_title( $name ); ?>">

	<?php do_action( 'wc_product_addon_start', $addon ); ?>

	<?php if ( $name ) : ?>
		<h3 class="addon-name"><?php echo wptexturize( $name ); ?> <?php if ( 1 == $required ) echo '<abbr class="required" title="' . __( 'Required field', 'woocommerce-product-addons' ) . '">*</abbr>'; ?></h3>
	<?php endif; ?>

	<?php if ( $description ) : ?>
		<?php echo '<div class="addon-description">' . wpautop( wptexturize( $description ) ) . '</div>'; ?>
	<?php endif; ?>

	<?php do_action( 'wc_product_addon_options', $addon ); ?>

</div></div>
</div>
&#13;
&#13;
&#13;

0 个答案:

没有答案