这个代码到wordpress侧边栏有什么问题

时间:2014-01-30 17:39:57

标签: php wordpress wordpress-theming

我有一个主题,但安装后会出现侧栏错误。你能找到错误来帮我解决这个问题。

这是我得到的错误

  

解析错误:语法错误,第53行的C:\ xampp \ htdocs \ movie \ wp-content \ themes \ stargate \ sidebar.php中的意外T_ENDIF

<?
global $options;
foreach ($options as $value) {
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else {  $$value['id'] = get_settings( $value['id'] ); }}?>
<div class="sidebar">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<ul class="widget_categories">
 <li><h3>Items Categories</h3>
<ul>
<?php $categories = wp_list_categories('echo=0&title_li=');
$categories = preg_replace('/View all posts filed under /','',$categories);
echo $categories; ?>
        </ul>
    </li>
</ul>

<?php if ( is_category() ) { ?>
<?php if (function_exists('get_most_viewed_category')): ?>
<ul>
    <li><h3>Most Popular Items in Category</h3>
        <ul>
            <?php get_most_viewed_category(get_query_var("cat"),'both',10); ?>
        </ul>
    </li>
</ul>
<?php endif; ?>
<? } else { ?>
<?php if (function_exists('get_most_viewed')): ?>
<ul>
    <li><h3>Most Popular Items</h3>
        <ul>
            <?php get_most_viewed('post', 10); ?>
        </ul>
    </li>
</ul>
<?php endif; ?>
<? } ?>

<?if ($wp_300250_disable == "false") { ?>
<ul>
    <li><h3>Sponsors</h3>
        <ul class="banners">
        <? if ($wp_300250) { ?>
        <? echo stripslashes($wp_300250); ?>
        <? } else { ?>
            <img src="<?php bloginfo('template_directory'); ?>/images/300250.gif" alt="Sponsor" />
        <? } ?> 
        </ul>
    </li>
</ul> 
<? } else { ?>
<? } ?>
<ul>
<li><h3>Latest Comments</h3>
<?php
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
comment_post_ID, comment_author, comment_date_gmt, comment_approved,
comment_type,comment_author_url,
SUBSTRING(comment_content,1,30) AS com_excerpt
FROM $wpdb->comments
LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
$wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = '' AND
post_password = ''
ORDER BY comment_date_gmt DESC
LIMIT 10";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
$output .= "\n<ul>";
foreach ($comments as $comment) {
$output .= "\n<li>".strip_tags($comment->comment_author)
.":" . " <a href=\"" . get_permalink($comment->ID) .
"#comment-" . $comment->comment_ID . "\" title=\"on " .
$comment->post_title . "\">" . strip_tags($comment->com_excerpt)
."</a>...</li>";
}
$output .= "\n</ul>";
$output .= $post_HTML;
echo $output;?>
    </li>
</ul>
<?php if ( is_single() ) { ?>
<?php wp_reset_query(); ?> 
<ul>
    <li><h3>Items Tags</h3>
        <ul class="banners">
            <?php the_tags( '', ', ', ''); ?>
        </ul>
    </li>
</ul>
<?php } ?>  
<?php endif; ?>
</div>

2 个答案:

答案 0 :(得分:2)

感谢Jenson M John,我解决了这个问题。解决方案是我使用了<?php而不是<?

答案 1 :(得分:1)

更改

<?if ($wp_300250_disable == "false") { 

<? if ($wp_300250_disable == "false") {