2012-01-10 12 views
0

ショップコンテンツの後に配置したい機能がいくつかありますが、ショップコンテンツはPHPファイルで生成され、機能のコンテンツはWordpressページの静的HTMLに書き込まれます。フィーチャーのコンテンツはショップのコンテンツの前に表示され、それを切り替える必要があります。ショップコンテンツの下に機能コンテンツを配置する方法

Webページがである:ここではhttp://www.bolistylus.com/shop/

ページは現在、次のようになります。ここでは

enter image description here

は、お店のコンテンツのためのPHPコードである:ここで

<?php 
/** 
* Loop shop template 
* 
* DISCLAIMER 
* 
* Do not edit or add directly to this file if you wish to upgrade Jigoshop to newer 
* versions in the future. If you wish to customise Jigoshop core for your needs, 
* please use our GitHub repository to publish essential changes for consideration. 
* 
* @package Jigoshop 
* @category Catalog 
* @author  Jigowatt 
* @copyright Copyright (c) 2011 Jigowatt Ltd. 
* @license http://jigoshop.com/license/commercial-edition 
*/ 
?> 

<?php 
global $columns, $per_page; 

do_action('jigoshop_before_shop_loop'); 

$loop = 0; 

if (!isset($columns) || !$columns) $columns = apply_filters('loop_shop_columns', 4); 
//if (!isset($per_page) || !$per_page) $per_page = apply_filters('loop_shop_per_page', get_option('posts_per_page')); 

//if ($per_page > get_option('posts_per_page')) query_posts(array_merge($wp_query->query, array('posts_per_page' => $per_page))); 

ob_start(); 

if (have_posts()) : while (have_posts()) : the_post(); $_product = &new jigoshop_product($post->ID); $loop++; 

    ?> 
    <li class="product <?php if ($loop%$columns==0) echo 'last'; if (($loop-1)%$columns==0) echo 'first'; ?>"> 

     <?php do_action('jigoshop_before_shop_loop_item'); ?> 

     <a href="<?php the_permalink(); ?>"> 

      <?php do_action('jigoshop_before_shop_loop_item_title', $post, $_product); ?> 

      <strong><?php the_title(); ?></strong> 

      <?php do_action('jigoshop_after_shop_loop_item_title', $post, $_product); ?> 

     </a> 

     <?php do_action('jigoshop_after_shop_loop_item', $post, $_product); ?> 

    </li><?php 

    if ($loop==$per_page) break; 

endwhile; endif; 

if ($loop==0) : 

    echo '<p class="info">'.__('No products found which match your selection.', 'jigoshop').'</p>'; 

else : 

    $found_posts = ob_get_clean(); 

    echo '<ul class="products">' . $found_posts . '</ul><div class="clear"></div>'; 

endif; 

do_action('jigoshop_after_shop_loop'); 

機能コンテンツのhtmlです:

<div class="entry-content"> 
<h1 class="description-title">WHY IS BOLI BETTER?</h1> 
<div class="feature feature-item-248"><img class="main" src="http://www.bolistylus.com/wp-content/uploads/uclaproduct.png" alt="" /> 
<div class="feature_description"> 
<div class="feature_description_header"> 
<h2 class="descript-heading">PERFECTLY WEIGHTED</h2> 
</div> 
<div class="feature_description_content"> 

Touch screens have simplified technology, but there has yet to be a way to capture the precision of a calligrapher or the stroke of an artist. Not only should it meet your needs, but a stylus should have style. 

</div> 
</div> 
</div> 
<div class="feature feature-item-252"><img class="main" src="http://www.bolistylus.com/wp-content/uploads/pinkproduct.png" alt="" /> 
<div class="feature_description"> 
<div class="feature_description_header"> 
<h2 class="descript-heading">PEN-LIKE PRECISION</h2> 
</div> 
<div class="feature_description_content"> 

Your stylus should be as sharp as your ideas. The thin and clear disc gives you the accuracy you want in a digital pen. 

</div> 
</div> 
</div> 
<div class="feature feature-item-254"> 

<img class="main" src="http://www.bolistylus.com/wp-content/uploads/blueproduct.png" alt="" /> 
<div class="feature_description"> 
<div class="feature_description_header"> 
<h2 class="descript-heading">BALL POINT</h2> 
</div> 
<div class="feature_description_content"> 

Hold your stylus at the angle you’re most comfortable with. Jot gives you the freedom to write or sketch like you’re used to. 

</div> 
</div> 
</div> 
<div class="feature feature-item-256"> 

<img class="main" src="http://www.bolistylus.com/wp-content/uploads/greenproduct.png" alt="" /> 
<div class="feature_description"> 
<div class="feature_description_header"> 
<h2 class="descript-heading">HEAVY METAL</h2> 
</div> 
<div class="feature_description_content"> 

Once Jot is in your grip, the quality is unmistakable. The durable aluminum and steel gives Jot superior conductivity and craftsmanship comparable to any luxury pen. 

</div> 
</div> 
&nbsp; 

</div> 
</div> 

答えて

0

この行は、製品のリストを作成:

echo '<ul class="products">' . $found_posts . '</ul><div class="clear"></div>'; 

ショップの内容です。 Firebugを使用してページを検査すると、表示されている5つの製品(ショップのコンテンツ)を含むul.productsが表示されます。

後で機能コンテンツを表示するためにできることは、静的データ用のHTML文字列を作成し、それを上記のechoステートメントに追加することです。たとえば。

$product_string = ""; 
$product_string = "<ul class='products'>" . $found_posts . "</ul><div class='clear'></div>"; 
$product_string .= "<div class='entry-content'><h1 class='description-title'>WHY IS BOLI BETTER?</h1>"; 

/* First Product */ 
$product_string .= "<div class='feature feature-item-248'><img class='main' src='http://www.bolistylus.com/wp-content/uploads/uclaproduct.png' alt='' /><div class='feature_description'><div class='feature_description_header'><h2 class='descript-heading'>PERFECTLY WEIGHTED</h2></div><div class='feature_description_content'>Touch screens have simplified technology, but there has yet to be a way to capture the precision of a calligrapher or the stroke of an artist. Not only should it meet your needs, but a stylus should have style.</div></div></div>"; 

$product_string .= "</div>"; 

同様に、あなたは他の製品のための文字列を作成し、上記の文字列にそれらを追加することができます。すべての文字列を追加したら、変数をエコーするだけです。

echo $product_string; 

明らかに、これは最善の解決策ではありませんが、仕事を完了させるべきです。理想的には、フィーチャーのコンテンツをデータベースに取り込むこともできます。

また、渡されたフィーチャーアイテムIDに応じて、関連する情報を取得する関数を作成することができます。製品をループして、手動で作成する代わりに、HTML文字列を生成する関数を呼び出すことができます。

関連する問題