admin管理员组文章数量:1425787
So, I'm kind of stumped by this one, and I'm unable to find many other folks experiencing it.
I'm extending the "largo" theme for a site we're getting ready to launch, and am working within the child theme. The issue is that frequently (not always) when I open a file in PHPStorm to edit it, after deploying it to vagrant, I get an error like:
Parse error: syntax error, unexpected '';' (T_ENCAPSED_AND_WHITESPACE), expecting end of file in /srv/www/sitename/public_html/wp-content/themes/largo-child/inc/post-tags.php on line 413
To clarify - it isn't always this specific error, but some unexpected character.
Adding a closing PHP tag fixes it, at which point I can clear cache, remove the closing PHP tag, and all seems well (until it happens again).
This was happening just with the wp-config.php
file initially, so I thought there might be a hidden character in that file or something similar. Now that I'm moving out and building out other parts of the theme, this is happening somewhat consistently across the codebase.
The file in question has nothing odd in it, and is unchanged. Here's the end of the file where the error is thrown (for completeness) - but I'm guessing this isn't where the issue lies. Here is the offending line 413 (line numbers added in parens):
/**
* Output largo_edited_date() on the single post template
*
* This is disabled in Largo by default. To add it to your child theme, paste in this:
*
* #add_action( 'largo_after_hero', 'largo_after_hero_largo_edited_date', 5 );
*
* @since 0.5.5
* @action largo_after_hero
* @uses largo_edited_date
* @link
*/
(406) function largo_after_hero_largo_edited_date() {
(407) if ( largo_post_was_updated() ) {
(408) echo '<div class="entry-content clearfix">';
(409) largo_edited_date();
(410) echo '</div>';
(411) }
(412) }
(413)
It also seems like it can be reliably fixed by copying/pasting the contents of the file out into sublime, and then pasting them back in - which makes me wonder if this is something being added in by PHPStorm when I open a file?
Grateful for any help or guidance you all can suggest - thanks in advance.
** edited to add line numbers to above example **
本文标签: theme developmentWordpress files break if I edit thembut adding a closing PHP tag fixes it
版权声明:本文标题:theme development - Wordpress files break if I edit them, but adding a closing PHP tag fixes it 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745425863a2658107.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论