最近从不同的柱子类型中拉出柱子

时间:2012-08-20 作者:João Paulo

此博客页面来自名为full width blog的页面模板。php。内容的左边是假定的一般帖子应该出现的地方。右边是侧边栏。

你怎么能从最近的文章而不是推荐中得出主要的左派观点?

有关示例,请参见图:http://i.imgur.com/gVsnb.png

全宽博客:http://pastebin.com/R6BD1R8u

1 个回复
最合适的回答,由SO网友:Bainternet 整理而成

这是一次修复边栏代码的尝试:

<div id="rightcolumn-wrapper">
  <div class="rightcolumn-inner">

    <?php   /* Widgetized sidebar */

        if ( !function_exists(\'dynamic_sidebar\') || !dynamic_sidebar(\'sidebar\') ) : ?>


     <?php /* If a title has been provided, we\'ll use that. */
             $NewsTitle=get_option(\'NewsTitle\');
            if ($NewsTitle) { 
            echo \' <h3 class="news">\';            
             echo $NewsTitle;
            echo \'</h3>\';
            // Otherwise we\'ll use a generic message.
            } else { ?>
      <h3>Recent News</h3>
      <?php } ?>

    <?php 
                $News=get_option("News");
                $news_Query =  new WP_Query(array(
                  \'cat\' => $News,
                  \'posts_per_page\' => get_option("newspostlimit"),
                  \'post_type\' => \'post\'
                )); 
    ?><ul class="news">
    <?php while ($news_Query->have_posts()) : $news_Query->the_post(); ?>
      <li> 
        <strong><?php the_time(\'F jS, Y\') ?> : </strong>
        <br />
        <?php the_title(); ?> :
        <a href="<?php the_permalink() ?>"> 
        <?php the_content_rss(\'cut\', TRUE, \'\', 20); ?>
        </a>
        <a href="<?php the_permalink() ?>" class="view-more">&nbsp;</a>
      </li>      
    <?php endwhile;
    wp_reset_query(); ?>
    </ul>

    <?php /* If a title has been provided, we\'ll use that. */
    $TestimonialTitle=get_option(\'TestimonialTitle\');
    if ($TestimonialTitle) { 
      echo \' <h3 class="news">\';            
      echo $TestimonialTitle;
      echo \'</h3>\';
    // Otherwise we\'ll use a generic message.
    } else { ?>
      <h3>Testimonial</h3>
    <?php 
    }
    $Testimonial=get_option("Testimonial");
    $testi_Query = new WP_Query(array(\'cat\'=> $Testimonial, \'posts_ter_page\' =>  get_option("Testimonialpostlimit"))); 
    ?>
    <ul class="testimonial">
    <?php while ($testi_Query->have_posts()) : $testi_Query->the_post(); ?>
      <li> 
        <?php the_content_rss(\'cut\', TRUE, \'\', 20); ?>
        <br />
        <strong>
          <?php the_title(); ?>
        </strong>
        <a href="<?php the_permalink() ?>" class="view-more">&nbsp;</a>
      </li>
    <?php endwhile;
    wp_reset_query(); ?>
    </ul>


    <ul>
      <li>
        <?php /* If a title has been provided, we\'ll use that. */
          $ContactInfoTitle=get_option(\'ContactInfoTitle\');
          if ($ContactInfoTitle) { 
            echo \' <h3 class="contact-info">\'.$ContactInfoTitle.\'</h3>\';
             // Otherwise we\'ll use a generic message.
          } else { ?>
            <h3 class="contact-info">Contact Info</h3>
          <?php 
          }
          $ContactInfo=get_option(\'ContactInfo\');
          if ($ContactInfo) { 
            echo stripslashes($ContactInfo);           
            // Otherwise we\'ll use a generic message.
          } else { ?>
            <p>Mauris a libero metus, vel blandit lectus. Praesent egestas ultrices turpis eget vestibulum. Pellentesque ligula sem, porta nec venenatis vel, volutpat non tortor. </p>
          <?php } ?>
    </li>
  </ul>



    <ul>
    <li>
      <?php /* If a title has been provided, we\'ll use that. */
             $SocialTitle=get_option(\'SocialTitle\');
            if ($SocialTitle) { 
              echo \' <h3 class="news">\'.$SocialTitle.\'</h3>\';
            // Otherwise we\'ll use a generic message.
            } ?>
      <div class="socil-book-marks">
      <?php 
      $TwitterID=get_option(\'TwitterID\');
     $FacebookID=get_option(\'FacebookID\');
      $FlickrID=get_option(\'FlickrID\');
     $DeliciousID=get_option(\'DeliciousID\');
     $TechnoratiID=get_option(\'TechnoratiID\');


      if($TwitterID) { ?>
      <a href="<?php echo get_option(\'TwitterID\'); ?>"><img src="<?php bloginfo(\'template_url\'); ?>/images/twitter.png" alt="twitter" /></a> 
      <?php }       
    if($FacebookID) { ?>
      <a href="<?php echo get_option(\'FacebookID\'); ?>"><img src="<?php bloginfo(\'template_url\'); ?>/images/facebook.png" alt="myspace" /></a>
         <?php }       
    if($FlickrID) { ?>
       <a href="<?php echo get_option(\'FlickrID\'); ?>"><img src="<?php bloginfo(\'template_url\'); ?>/images/flicker.png" alt="flickr" /></a>
           <?php }       
    if($DeliciousID) { ?>
        <a href="<?php echo get_option(\'DeliciousID\'); ?>"><img src="<?php bloginfo(\'template_url\'); ?>/images/delicious.png" alt="delicious" /></a> 
           <?php }       
    if($TechnoratiID) { ?>
        <a href="<?php echo get_option(\'TechnoratiID\'); ?>"><img src="<?php bloginfo(\'template_url\'); ?>/images/technorati.png" alt="technorati" /></a>
        <?php } ?>
         </div>
    </li>
    </ul>
    <?php endif; ?>
  </div>
</div>

<!-- End Main section #main  -->
<div class="clear"></div>

结束

相关推荐

如何使用PYTHON使用Blogger API拉取WordPress博客数据

Wordpress提到它支持Blogger API(link). 那么,谁能告诉我如何使用Blogger API(使用python)v3来获取wordpress公共博客数据。或者,是否有任何wordpress API可以从其博客中提取公共数据?(语言:Python)。如果有任何有用的文件能够清楚地解释程序,我们将不胜感激。