初心者からPHPへ次のエラーが表示されます。PHP構文エラーが予期しない '}'
Parse error: syntax error, unexpected '}' in ... on line 1
以下はこのコードの例です。この単純な間違いを見つけるのは難しいです。誰でも助けることができますか?このファイルはWordPressのテーマのファイルで、PHPで書かれています。
<?php
// Using hooks is absolutely the smartest, most bulletproof way to implement things like plugins,
// custom design elements, and ads. You can add your hook calls below, and they should take the
// following form:
// add_action('thesis_hook_name', 'function_name');
// The function you name above will run at the location of the specified hook. The example
// hook below demonstrates how you can insert Thesis' default recent posts widget above
// the content in Sidebar 1:
// add_action('thesis_hook_before_sidebar_1', 'thesis_widget_recent_posts');
// Delete this line, including the dashes to the left, and add your hooks in its place.
/**
* function custom_bookmark_links() - outputs an HTML list of bookmarking links
* NOTE: This only works when called from inside the WordPress loop!
* SECOND NOTE: This is really just a sample function to show you how to use custom functions!
*
* @since 1.0
* @global object $post
*/
function custom_bookmark_links() {
global $post;
?>
<ul class="bookmark_links">
<li><a rel="nofollow" href="http://delicious.com/save?url=<?php urlencode(the_permalink()); ?>&title=<?php urlencode(the_title()); ?>" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url=<?php urlencode(the_permalink()); ?>&title=<?php urlencode(the_title()); ?>', 'delicious', 'toolbar=no,width=550,height=550'); return false;" title="Bookmark this post on del.icio.us">Bookmark this article on Delicious</a></li>
</ul>
<?php
}
/*** HEADER AD WIDGET***/
register_sidebars(1,
array(
'name' => 'HeaderAd',
'before_widget' => '<li id="%1$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>'
)
);
function header_widget() { ?>
<div id="header_widget_1">
<ul class="sidebar_list">
<?php thesis_default_widget(3); ?>
</ul>
</div>
<?php }
add_action('thesis_hook_header', 'header_widget', '1');
/*** HEADER WIDGET END***/
/*remove footer attribution*/
remove_action('thesis_hook_footer', 'thesis_attribution');
function seth_godin_stuff_1() {
if (is_single()) {
?>
<p class="alert" style="text-align:center;">Interested in a free 25+ eBook on the 7 Wastes? Please <a href="http://www.shmula.com/7-wastes-of-lean/">DOWNLOAD HERE</a>.</p>
<?php
}
}
add_action('thesis_hook_before_post', 'seth_godin_stuff_1', '1');
function single_post_ads() {
if (is_single()) { ?>
<BR>
<div align="center">
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td rowspan="2"><script type="text/javascript" src="http://forms.aweber.com/form/06/1421749706.js"></script></td>
<td><a target="new" href="http://amzn.to/ddLMpa"><img class="alignnone size-full wp-image-4151" title="the-toyota-way-ad-unit" src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2010/08/the-toyota-way-ad-unit.jpg" alt="" width="102" height="157" /></a></td>
<td><a target="new" href="http://amzn.to/9epSyC"><img class="alignnone size-full wp-image-4152" title="the-toyota-way-fieldbook-ad-unit" src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2010/08/the-toyota-way-fieldbook-ad-unit.jpg" alt="" width="111" height="158" /></a></td>
<td><a target="new" href="http://amzn.to/ac4i1v"><img class="alignnone size-full wp-image-4149" title="the-toyota-culture-ad-unit" src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2010/08/the-toyota-culture-ad-unit.jpg" alt="" width="98" height="161" /></a></td>
</tr>
<tr><td colspan="5"><div align="center"><h5>This post was written by <a href="http://www.shmula.com/about-peter-abilla/" rel="author">Pete Abilla</a></h5>
</div></td></tr>
</tbody>
</table>
</div>
<?php }
}
add_action('thesis_hook_after_post', 'single_post_ads');
remove_action('thesis_hook_after_post', 'thesis_post_tags');
/*social bookmarks right header*/
function thesis_header_ad() {
?>
<div id="banner_ad">
<div align="center">
<a rel="nofollow" href="http://www.linkedin.com/in/shmula">
<img src="http://www.shmula.com/wp-content/uploads/image/social-icons/linkedin.jpg"
height="68" width="68" border="0" alt="" /></a> <a rel="nofollow" href="http://twitter.com/shmula">
<img src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2011/04/Twitter.png" height="70" width="70" border="0"
alt="follow shmula on twitter" /></a> <a rel="nofollow"
href="http://www.facebook.com/shmula">
<img src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2011/04/FaceBook.png"
height="70" width="70" border="0" alt="" /></a> <a href="http://feeds.feedburner.com/shmula/dfYo">
<img src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2011/04/Feed.png"
height="70" width="70" border="0" alt="" /></a> <a href="http://forms.aweber.com/form/77/1324894377.htm">
<img src="http://www.shmula.com/wp-content/uploads/image/social-icons/Email.gif"
height="70" width="70" border="0" alt="" /></a>
</div>
</div>
<?php
}//end of php block
/* BEGIN Custom Widgetized Footer */
if (function_exists('register_sidebar')) {
register_sidebar(array('name' => 'Footer Widget ', 'id' => 'footer-widget-', 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));}
function widgetized_footer() { ?><div id="widgetized_wrapper"> <?php
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Widget')) : ?>
<?php endif; ?>
</div>
<?php
}
remove_action('thesis_hook_footer', 'thesis_attribution');add_action('thesis_hook_footer', 'widgetized_footer');
/* END Custom Widgetized Footer *//*footer widget*/
/*custom popular posts thumbnails*/
function pop_posts_with_thumbs() { ?>
<li class="widget popular_posts">
<h3>POPULAR POSTS</h3>
<ul>
<? $args = array('posts_per_page' => 28, 'orderby' => 'comment_count', 'category__in' => array(131,16,29,17,281,651,120,193,650,135,147,9,508,64,613,654,655));
global $post;
$popular = get_posts($args);
foreach($popular as $post) {
setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>" title="Permalink to <?php the_title(); ?>">
<?php if(has_post_thumbnail()) { the_post_thumbnail('thumb'); } ?><?php the_title(); ?>
</a>
</li>
<!--[if lte IE 6]>
<div class="clear"></div>
<![endif]-->
<? } ?>
</ul>
</li>
<? }
add_action('thesis_hook_after_sidebar_1', 'pop_posts_with_thumbs');
/*thumbnail functions*/
add_theme_support('post-thumbnails');
set_post_thumbnail_size(610, 9999, true);
add_image_size('teaser', 150, 150, true);
add_image_size('thumb', 50, 50, true);
/*link rel for next/prev*/
add_action('wp_head', 'index_rel_link'); // Relational link for site index
add_action('wp_head', 'start_post_rel_link'); // Relational link for first post
add_action('wp_head', 'adjacent_posts_rel_link_wp_head'); // Relational links for adjacent posts
add_action('wp_head', 'parent_post_rel_link'); // Relational link for parent item
これは*スパゲッティコード*であることをご承知おきください。 –
どのようなエディタを使用していますか?構文チェックをサポートしていますか?どのような情報があなたに届いていますか?またはあなたはメモ帳を使用していますか? – Dan
ところで、 'http://www.shmula.com/http:// www.shmula.com /'を検索すると、あなたのコードにどれくらいの頻度で表示されているのでしょうか? – sarnold