<?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="<?php urlencode(the_permalink()); ?>&amp;title=<?php urlencode(the_title()); ?>" onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=<?php urlencode(the_permalink()); ?>&amp;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
}


remove_action('thesis_hook_before_header', 'thesis_nav_menu');
add_action('thesis_hook_after_header', 'thesis_nav_menu');

I was trying to edit my custom php to make my header clickable, so I followed the instructions on another site and now I'm getting this error on my site: http://www.loungeowl.com/

Dani AI

Generated

A PHP "Parse error: syntax error, unexpected T_STRING on line 51" means the parser found a string where it didn't expect one. The usual causes in a theme file are mismatched quotes, an unterminated string, stray PHP open/close tags, or HTML injected into an attribute without escaping. Because this was in a custom theme file, any pasted HTML/PHP that changes quote nesting will trigger that parse error and can take the whole site offline.

Practical debugging steps:

  • Access the file directly (FTP, SFTP, or your host file manager) and open the exact file that produced the error. Inspect the stated line and a few lines above it — PHP errors often show the line after the true problem.
  • Use a code editor with PHP highlighting or run php -l filename locally to lint the file. If you cannot run linting, copy the file into an editor that shows unmatched quotes/parentheses.
  • Temporarily enable WP_DEBUG only while diagnosing (and turn it off afterward), or check the host error log for the full message.
  • If the site is inaccessible, restore a working copy (as happened here) or rename the theme folder to regain admin access, then reintroduce changes in small steps.

WordPress best practices to avoid this in future: prefer functions that return values (get_permalink()) instead of ones that echo (the_permalink()), and always escape output for attributes with esc_url()/esc_attr() and explicitly echo the returned value. For example:

<?php echo urlencode( get_permalink() ); ?>
<a href="<?php echo esc_url( get_permalink() ); ?>">Bookmark</a>

Also follow 's hint — check quotes first; they're the most common culprit. Use a local dev environment, version control, and keep backups so a quick revert (or host restore, as experienced) fixes the site without downtime.

Recommended Answers

All 4 Replies

I'm not sure why it says line 51, because I removed that entire string of code.

T think it is the missing of double quotes/single quote.The code u posted have no errors.I executed after commenting the 2 function calls.If u can post entire code

What I posted is all the code I have in the custom_functions.php template.. There is no more.

And because of this error, the site isn't allowing me to even click on any of the other templates or any page. I'm using wordpress.

I'm not sure what the error was, but my hosting reset the code for me, so it's fixed now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.