首页 新闻 赞助 找找看

有熟悉wordpress的吗,请问下面的条件语句代码有什么问题吗?

0
悬赏园豆:30 [已解决问题] 解决于 2014-03-25 09:49

网站是wordpress做的,本人其实不懂PHP,只是修改了一下别人的模板,因为wordpress本身是一个博客建站系统,所以,它有博客的特点,那就是页面变化单一,内页和主页版式没多大的变化,比如许多博客主页显示友情链接,但是内页同样也显示友情链接。要把它变成一个CMS还是需要进行一下修改的。看网站 http://www.lidefeng.cn/

 

主要修改了网站的底部,都是通过条件语句进行个性化定制的:

1、底部左边

用条件语句判断,当页面是首页时显示友情链接,否则显示其他内容。

2、底部右边

当页面是首页时则调用最新文章,否则则显示其他内容。

 

因该模板的原版本身就使用了一些条件语句,然后我为了个性化定制上面内容又插入了两段条件语句,结果形成了多层嵌套,自己当时添加代码也看得晕头转向的。

但是,因为我其实不懂PHP,只是依葫芦画瓢插入了条件语句代码,所以,不清楚这些代码在语法上有没有错误,或者在逻辑上有没有错误?

<div class="footer_widgetcenter">                

                <?php if (get_option('widget_center_top_active', 'on') == "on") { ?>

                <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Footer Widget Center-Top')) {} else { ?>

                <div class="footer_widgetcenter_top">

                    <h3><?php echo get_option("widget_center_title_1", "Easy installation and upgrades"); ?></h3>

                    <?php $center_top_content = "<img src=\"".get_bloginfo('template_url')."/images/icons/footer_started.png\" class=\"alignleft\" alt=\"\" />We have gone to great lengths too make sure every bit of the WordPress generated code is in full compliance with the standards of the <a href=\"http://www.w3.org/\" target=\"_blank\">W3C</a> This is important only a interoperability with today browser but also for forward compatibility with the tools the next generation. Your web site is a beautiful thing..."; ?>

                    <?php echo get_option("widget_center_content_1", $center_top_content); ?>

                </div>    
                
                <?php }  } ?>        
                                
                <?php if (get_option('widget_center_bottom_left_right_active', 'on') == "on") { ?>

                <div class="footer_widgetcenter_left">                

                <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Footer Widget Bottom-Left')) {} else { ?>

                <?php wp_reset_query(); if ( is_home() ) { ?> 
<div class="footer_links">

<?php wp_list_bookmarks('title_before=<h3>&title_after=</h3>&category_before=&category_after='); ?>

</div>

<?php } else {?>

                    <h3>针织牛仔</h3>                    

                    <div class="footer_comments">

                        <ul>                        

<img src="http://www.lidefeng.cn/wp-content/uploads/2013/10/DSC058941.png" width="50" height="50" style="margin:4px 10px 0px 5px" align="left">针织牛仔布(Knitted denim)是用针织工艺编织的牛仔布,有传统牛仔面料和针织物的双重特性。它采用针织纬编的织法,采用束状染色的靛蓝、蓝加黑、硫化黑等针织筒子纱在大圆机上实行特殊工艺生产出来的具有水洗褪色效果的面料。
                        

                        </ul>

                    </div>
                    
<?php }  ?>
                <?php }  ?>

                </div>
                                                
                <div class="footer_widgetcenter_right">
                
                    <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Footer Widget Bottom-Right')) {} else { ?>
                    <?php wp_reset_query(); if ( is_home() ) { ?> 

<h3><?php echo get_option("widget_center_bottom_right", "Popular Posts"); ?></h3>
                                        
                    <div class="footer_posts">

                        <ul>
                        
                        <?php 
                wp_reset_query();
                query_posts("cat=1,18&showposts=5&paged=1");
                while(have_posts()) : the_post();
            ?>
            <li><a href="<?php the_permalink(); ?>"><?php the_title() ?></a></li>
            <?php endwhile; ?>

                        </ul>

                    </div>


<?php } else {?>

<h3>传承经典</h3>

<div class="footer_posts">

<img src="http://www.lidefeng.cn/wp-content/uploads/2013/10/DSC056921.jpg" width="200" height="132">

                    </div>
<?php }  ?>

                    <?php }  ?>                    

                </div>                

                <?php }  ?>

            </div>
            
半杯酒的主页 半杯酒 | 初学一级 | 园豆:157
提问于:2013-10-25 15:37
< >
分享
最佳答案
1

你在外觀-》小工具那改改試試,我覺得footer固定就好,不用變,一般沒人看那裡的

收获园豆:30
+小马哥++ | 小虾三级 |园豆:906 | 2013-10-25 16:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册