{"id":4869009,"date":"2014-05-01T08:47:38","date_gmt":"2014-05-01T08:47:38","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/t_string-isssue-in-my-wordpress-widget\/"},"modified":"2016-08-21T19:55:55","modified_gmt":"2016-08-21T19:55:55","slug":"t_string-isssue-in-my-wordpress-widget","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/t_string-isssue-in-my-wordpress-widget\/","title":{"rendered":"T_STRING isssue in my wordpress widget"},"content":{"rendered":"<p>i got this error when i install my theme online <\/p>\n<p>&#8221; <strong>Parse error: syntax error, unexpected T_STRING<\/strong> in \/home\/thememon\/public_html\/demo\/wordpress-templates\/webfirst\/wp-content\/themes\/blogmonstor\/include\/widgets.php on line 1 &#8220;<\/p>\n<p>but when i using this theme on localhost it working fine <\/p>\n<p>and i have not find ant T_String error so please tell me where is that <\/p>\n<p><strong>here is my code<\/strong><\/p>\n<pre><code>&lt;?php\nclass BGTabsWidget extends WP_Widget {\n\nfunction BGTabsWidget() {\n\t\t$widget_ops = array(\n\t\t&#039;classname&#039; =&gt; &#039;BGTabsWidget&#039;,\n\t\t&#039;description&#039; =&gt; &#039;Simple jQuery Tabber Widget&#039;,\n);\n$this-&gt;WP_Widget(\n\t\t&#039;BGTabsWidget&#039;,\n\t\t&#039;BlogMonstor Tabber Widget&#039;,\n\t\t$widget_ops\n);\n}\nfunction widget($args, $instance) { \/\/ widget sidebar output\n\nfunction bg_tabber() { ?&gt;\n\n&lt;ul class=&quot;tabs&quot;&gt;\n&lt;li class=&quot;active bg-primary&quot;&gt;&lt;a href=&quot;#tab1&quot;&gt;Recent Post&lt;\/a&gt;&lt;\/li&gt;\n&lt;li class=&quot;bg-primary&quot;&gt;&lt;a href=&quot;#tab2&quot;&gt;Popular Post&lt;\/a&gt;&lt;\/li&gt;\n&lt;li class=&quot;bg-primary&quot;&gt;&lt;a href=&quot;#tab3&quot;&gt;Recent Comment&lt;\/a&gt;&lt;\/li&gt;\n&lt;\/ul&gt;\n\n&lt;div class=&quot;tab_container&quot;&gt;\n\n&lt;div id=&quot;tab1&quot; class=&quot;tab_content&quot;&gt;\n\n&lt;ul class=&quot;media-list&quot;&gt;\n&lt;?php\n$recent_posts = wp_get_recent_posts(array( &#039;numberposts&#039; =&gt; 5, &#039;orderby&#039; =&gt; &#039;rand&#039;));\nforeach($recent_posts as $post) : ?&gt;\n\n    &lt;li class=&quot;media&quot;&gt;\n\n        &lt;a class=&quot;pull-left&quot; href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title(); ?&gt;&quot;&gt;\n      &lt;?php if ( has_post_thumbnail($post[&#039;ID&#039;]) ) : ?&gt;\n\t&lt;?php echo get_the_post_thumbnail($post[&#039;ID&#039;], &#039;thumb-small&#039;,array( &#039;class&#039; =&gt; &#039;media-object recent-img&#039;)); ?&gt;\n\t&lt;?php else: ?&gt;\n        &lt;img src=&quot;&lt;?php echo get_template_directory_uri(); ?&gt;\/images\/thumb-small.png&quot; alt=&quot;&lt;?php the_title(); ?&gt;&quot; \/&gt;\n\t&lt;?php endif; ?&gt;\n    &lt;\/a&gt;\n\n        &lt;div class=&quot;media-body&quot;&gt;\n            &lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title(); ?&gt;&quot;&gt;&lt;h4 class=&quot;media-heading recent-title&quot;&gt;&lt;?php echo $post[&#039;post_title&#039;] ?&gt;&lt;\/h4&gt;&lt;\/a&gt;\n      &lt;div class=&quot;ell well-sm&quot;&gt;\n                     &lt;?php _e(&#039; &lt;i class=&quot;fa fa-user&quot;&gt;&lt;\/i&gt; &#039;, &#039;thememonstor&#039;); ?&gt;&amp;nbsp;&lt;?php the_author_posts_link(); ?&gt;&amp;nbsp;\n                    &lt;?php comments_popup_link(__(&#039; &lt;i class=&quot;fa fa-comments&quot; style=&quot;color:#2C3E50;&quot;&gt;&lt;\/i&gt;&amp;nbsp;(0)&#039;, &#039;thememonstor&#039;), __(&#039; &lt;i class=&quot;fa fa-comments&quot; style=&quot;color:#2C3E50;&quot;&gt;&lt;\/i&gt;&amp;nbsp;(1)&#039;, &#039;thememonstor&#039;), __(&#039; &lt;i class=&quot;fa fa-comments&quot; style=&quot;color:#2C3E50;&quot;&gt;&lt;\/i&gt;&amp;nbsp;(%)&#039;, &#039;thememonstor&#039;)); ?&gt;\n            &lt;\/div&gt;\n    &lt;\/div&gt;\n    &lt;\/li&gt;\n&lt;?php endforeach; ?&gt;\n&lt;\/ul&gt;\n&lt;\/div&gt;\n\n&lt;div id=&quot;tab2&quot; class=&quot;tab_content&quot; style=&quot;display:none;&quot;&gt;\n    &lt;ul class=&quot;media-list&quot;&gt;\n&lt;?php query_posts(&#039;orderby=comment_count&amp;posts_per_page=5&#039;); ?&gt;\n&lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;\n    &lt;li class=&quot;media&quot;&gt;\n\n        &lt;a class=&quot;pull-left&quot; href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title(); ?&gt;&quot;&gt;\n      &lt;?php if ( has_post_thumbnail() ): ?&gt;\n\t&lt;?php the_post_thumbnail(&#039;thumb-small&#039;,array( &#039;class&#039; =&gt; &#039;media-object recent-img&#039;)); ?&gt;\n\t&lt;?php else: ?&gt;\n            &lt;img width=&quot;150&quot; height=&quot;150&quot; src=&quot;&lt;?php echo get_template_directory_uri(); ?&gt;\/images\/thumb-small.png&quot; alt=&quot;&lt;?php the_title(); ?&gt;&quot; \/&gt;\n\t&lt;?php endif; ?&gt;\n    &lt;\/a&gt;\n\n        &lt;div class=&quot;media-body&quot;&gt;\n            &lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title(); ?&gt;&quot;&gt;&lt;h4 class=&quot;media-heading recent-title&quot;&gt;&lt;?php echo $post[&#039;post_title&#039;] ?&gt;&lt;\/h4&gt;&lt;\/a&gt;\n      &lt;div class=&quot;ell well-sm&quot;&gt;\n                     &lt;?php _e(&#039; &lt;i class=&quot;fa fa-user&quot;&gt;&lt;\/i&gt; &#039;, &#039;thememonstor&#039;); ?&gt;&amp;nbsp;&lt;?php the_author_posts_link(); ?&gt;&amp;nbsp;\n                    &lt;?php comments_popup_link(__(&#039; &lt;i class=&quot;fa fa-comments&quot; style=&quot;color:#2C3E50;&quot;&gt;&lt;\/i&gt;&amp;nbsp;(0)&#039;, &#039;thememonstor&#039;), __(&#039; &lt;i class=&quot;fa fa-comments&quot; style=&quot;color:#2C3E50;&quot;&gt;&lt;\/i&gt;&amp;nbsp;(1)&#039;, &#039;thememonstor&#039;), __(&#039; &lt;i class=&quot;fa fa-comments&quot; style=&quot;color:#2C3E50;&quot;&gt;&lt;\/i&gt;&amp;nbsp;(%)&#039;, &#039;thememonstor&#039;)); ?&gt;\n       &lt;\/div&gt;\n    &lt;\/div&gt;\n    &lt;\/li&gt;\n\n&lt;?php endwhile;endif;?&gt;&lt;!-- End Popular Posts --&gt;\n&lt;\/ul&gt;\n&lt;\/div&gt;\n\n&lt;div id=&quot;tab3&quot; class=&quot;tab_content&quot; style=&quot;display:none;&quot;&gt;\n    &lt;ul class=&quot;recent-comments&quot;&gt;\n\n           &lt;?php \n\n           $no_comments = 5; $comment_len = 100; $avatar_size = 70;\n\n\t$comments_query = new WP_Comment_Query();\n$comments = $comments_query-&gt;query( array( &#039;number&#039; =&gt; $no_comments ) );\n$comm = &#039;&#039;;\nif ( $comments ) : foreach ( $comments as $comment ) :\n$comm .= &#039;&lt;li&gt;&lt;a class=&quot;author&quot; href=&quot;&#039; . get_permalink( $comment-&gt;comment_post_ID ) . &#039;#comment-&#039; . $comment-&gt;comment_ID . &#039;&quot;&gt;&#039;;\n$comm .= get_avatar( $comment-&gt;comment_author_email, $avatar_size );\n$comm .= get_comment_author( $comment-&gt;comment_ID ) . &#039;:&lt;\/a&gt; &#039;;\n$comm .= &#039;&lt;p&gt;&#039; . strip_tags( substr( apply_filters( &#039;get_comment_text&#039;, $comment-&gt;comment_content ), 0, $comment_len ) ) . &#039;...&lt;\/p&gt;&lt;\/li&gt;&#039;;\nendforeach; else :\n$comm .= &#039;No comments.&#039;;\nendif;\necho $comm;\t\n\n?&gt;\n\n    &lt;\/ul&gt;\n&lt;\/div&gt;\n\n&lt;\/div&gt;\n\n&lt;div class=&quot;tab-clear&quot;&gt;&lt;\/div&gt;\n\n&lt;?php\n\n}\n\nextract($args, EXTR_SKIP);\n\/\/ pre-widget code from theme\necho $before_widget;\n$tabs = bg_tabber();\n\/\/ output tabs HTML\necho $tabs;\n\/\/ post-widget code from theme\necho $after_widget;\n}\n}\n\n\/\/ registering and loading widget\nadd_action( &#039;widgets_init&#039;,  create_function(&#039;&#039;,&#039;return register_widget(&quot;BGTabsWidget&quot;);&#039;));\n?&gt;<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-4869009","topic","type-topic","status-closed","hentry","topic-tag-widgets"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4869009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4869009\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4869009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}