• i got this error when i install my theme online

    Parse error: syntax error, unexpected T_STRING in /home/thememon/public_html/demo/wordpress-templates/webfirst/wp-content/themes/blogmonstor/include/widgets.php on line 1 “

    but when i using this theme on localhost it working fine

    and i have not find ant T_String error so please tell me where is that

    here is my code

    <?php
    class BGTabsWidget extends WP_Widget {
    
    function BGTabsWidget() {
    		$widget_ops = array(
    		'classname' => 'BGTabsWidget',
    		'description' => 'Simple jQuery Tabber Widget',
    );
    $this->WP_Widget(
    		'BGTabsWidget',
    		'BlogMonstor Tabber Widget',
    		$widget_ops
    );
    }
    function widget($args, $instance) { // widget sidebar output
    
    function bg_tabber() { ?>
    
    <ul class="tabs">
    <li class="active bg-primary"><a href="#tab1">Recent Post</a></li>
    <li class="bg-primary"><a href="#tab2">Popular Post</a></li>
    <li class="bg-primary"><a href="#tab3">Recent Comment</a></li>
    </ul>
    
    <div class="tab_container">
    
    <div id="tab1" class="tab_content">
    
    <ul class="media-list">
    <?php
    $recent_posts = wp_get_recent_posts(array( 'numberposts' => 5, 'orderby' => 'rand'));
    foreach($recent_posts as $post) : ?>
    
        <li class="media">
    
            <a class="pull-left" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
          <?php if ( has_post_thumbnail($post['ID']) ) : ?>
    	<?php echo get_the_post_thumbnail($post['ID'], 'thumb-small',array( 'class' => 'media-object recent-img')); ?>
    	<?php else: ?>
            <img src="<?php echo get_template_directory_uri(); ?>/images/thumb-small.png" alt="<?php the_title(); ?>" />
    	<?php endif; ?>
        </a>
    
            <div class="media-body">
                <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h4 class="media-heading recent-title"><?php echo $post['post_title'] ?></h4></a>
          <div class="ell well-sm">
                         <?php _e(' <i class="fa fa-user"></i> ', 'thememonstor'); ?>&nbsp;<?php the_author_posts_link(); ?>&nbsp;
                        <?php comments_popup_link(__(' <i class="fa fa-comments" style="color:#2C3E50;"></i>&nbsp;(0)', 'thememonstor'), __(' <i class="fa fa-comments" style="color:#2C3E50;"></i>&nbsp;(1)', 'thememonstor'), __(' <i class="fa fa-comments" style="color:#2C3E50;"></i>&nbsp;(%)', 'thememonstor')); ?>
                </div>
        </div>
        </li>
    <?php endforeach; ?>
    </ul>
    </div>
    
    <div id="tab2" class="tab_content" style="display:none;">
        <ul class="media-list">
    <?php query_posts('orderby=comment_count&posts_per_page=5'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <li class="media">
    
            <a class="pull-left" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
          <?php if ( has_post_thumbnail() ): ?>
    	<?php the_post_thumbnail('thumb-small',array( 'class' => 'media-object recent-img')); ?>
    	<?php else: ?>
                <img width="150" height="150" src="<?php echo get_template_directory_uri(); ?>/images/thumb-small.png" alt="<?php the_title(); ?>" />
    	<?php endif; ?>
        </a>
    
            <div class="media-body">
                <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h4 class="media-heading recent-title"><?php echo $post['post_title'] ?></h4></a>
          <div class="ell well-sm">
                         <?php _e(' <i class="fa fa-user"></i> ', 'thememonstor'); ?>&nbsp;<?php the_author_posts_link(); ?>&nbsp;
                        <?php comments_popup_link(__(' <i class="fa fa-comments" style="color:#2C3E50;"></i>&nbsp;(0)', 'thememonstor'), __(' <i class="fa fa-comments" style="color:#2C3E50;"></i>&nbsp;(1)', 'thememonstor'), __(' <i class="fa fa-comments" style="color:#2C3E50;"></i>&nbsp;(%)', 'thememonstor')); ?>
           </div>
        </div>
        </li>
    
    <?php endwhile;endif;?><!-- End Popular Posts -->
    </ul>
    </div>
    
    <div id="tab3" class="tab_content" style="display:none;">
        <ul class="recent-comments">
    
               <?php 
    
               $no_comments = 5; $comment_len = 100; $avatar_size = 70;
    
    	$comments_query = new WP_Comment_Query();
    $comments = $comments_query->query( array( 'number' => $no_comments ) );
    $comm = '';
    if ( $comments ) : foreach ( $comments as $comment ) :
    $comm .= '<li><a class="author" href="' . get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID . '">';
    $comm .= get_avatar( $comment->comment_author_email, $avatar_size );
    $comm .= get_comment_author( $comment->comment_ID ) . ':</a> ';
    $comm .= '<p>' . strip_tags( substr( apply_filters( 'get_comment_text', $comment->comment_content ), 0, $comment_len ) ) . '...</p></li>';
    endforeach; else :
    $comm .= 'No comments.';
    endif;
    echo $comm;	
    
    ?>
    
        </ul>
    </div>
    
    </div>
    
    <div class="tab-clear"></div>
    
    <?php
    
    }
    
    extract($args, EXTR_SKIP);
    // pre-widget code from theme
    echo $before_widget;
    $tabs = bg_tabber();
    // output tabs HTML
    echo $tabs;
    // post-widget code from theme
    echo $after_widget;
    }
    }
    
    // registering and loading widget
    add_action( 'widgets_init',  create_function('','return register_widget("BGTabsWidget");'));
    ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘T_STRING isssue in my wordpress widget’ is closed to new replies.