开发者

How to style widget in two columns?

Can someone gu开发者_运维百科ide me on how can I style "archive widget" to show two columns (as in image below)?

How to style widget in two columns?

I am new to wordpress and really don't know how to achieve this.


i designed my own widget something like

in my sidebar.php file by spliting categories data into two columns and then somewhere in page its stlying depending upon this data.

<?php       
 $catArray = explode("</li>",wp_list_categories('title_li=&echo=0&depth=1'));
 $catCount = count($catArray) - 1;
 $catColumns = round($catCount / 2);

 for ($i=0;$i<$catCount;$i++) {
  if ($i<$catColumns){
   $catLeft = $catLeft.''.$catArray[$i].'</li>';
          }
  elseif ($i>=$catColumns){
   $catRight = $catRight.''.$catArray[$i].'</li>';
   }  
 };
?>


I've only been using wordpress for a few months, but it seems that there's two parts to your problem -

First I would structure your two columns in a 2-column table. Secondly, as it's possible to replace wordpress functions, I would find the function that returns the archive links (probably returning them in a list of some sort). Try modifying this function to return the archived links in the above table structure. It would probably require abit of planning to figure what months you want displayed in each columns or row, but it shouldn't be too hard). This should return straight to your .php file and it should (in theory work) :)

Again, I've only started using wordpress a few months ago, but this is what I would attempt.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜