• Hi, I tried removing the heart/like buttons on my home page. It ended up creating an error and now I can’t even login. All I see is this:

    Parse error: syntax error, unexpected end of file in /home/joshuato/public_html/wp-content/themes/river/includes/qode-like.php on line 97

    I basically went to the editor and went to the “qode-like” and I tried tweaking the code to remove the “heart/like” symbol. Thing is, it worked and removed the symbol. But then I tweaked the code just a little bit more just to test things… that’s when the error happened!

    I still have the ORIGINAL CODE that goes in that “qode-like” section (I PASTED IT BELOW). I’m guessing all I have to do is login and paste it back again to get it back to normal. But that’s the thing, I can’t login anymore.

    Would really appreciate any help. Thanks again.

    <?php class QodeLike { function __construct(){ add_action(‘wp_enqueue_scripts’, array(&$this, ‘enqueue_scripts’)); add_action(‘wp_ajax_qode_like’, array(&$this, ‘ajax’)); add_action(‘wp_ajax_nopriv_qode_like’, array(&$this, ‘ajax’)); } function enqueue_scripts(){ wp_enqueue_script( ‘jquery’ ); wp_enqueue_script( ‘qode-like’, get_template_directory_uri() . ‘/js/qode-like.js’, ‘jquery’, ‘1.0’, TRUE ); wp_localize_script( ‘qode-like’, ‘qodeLike’, array( ‘ajaxurl’ => admin_url(‘admin-ajax.php’) )); } function ajax($post_id){ //update if( isset($_POST[‘likes_id’]) ) { $post_id = str_replace(‘qode-like-‘, ”, $_POST[‘likes_id’]); echo $this->like_post($post_id, ‘update’); } //get else { $post_id = str_replace(‘qode-like-‘, ”, $_POST[‘likes_id’]); echo $this->like_post($post_id, ‘get’); } exit; } function like_post($post_id, $action = ‘get’){ if(!is_numeric($post_id)) return; switch($action) { case ‘get’: $like_count = get_post_meta($post_id, ‘_qode-like’, true); if( !$like_count ){ $like_count = 0; add_post_meta($post_id, ‘_qode-like’, $like_count, true); } return ‘<i class=”icon-heart icon-large”></i><span class=”qode-like-count”>’. $like_count .'</span>’; break; case ‘update’: $like_count = get_post_meta($post_id, ‘_qode-like’, true); if( isset($_COOKIE[‘qode-like_’. $post_id]) ) return $like_count; $like_count++; update_post_meta($post_id, ‘_qode-like’, $like_count); setcookie(‘qode-like_’. $post_id, $post_id, time()*20, ‘/’); return ‘<i class=”icon-heart icon-large”></i><span class=”qode-like-count”>’. $like_count .'</span>’; break; } }

    function add_qode_like(){ global $post;

    $output = $this->like_post($post->ID); $class = ‘qode-like’; $title = __(‘Like this’, ‘qode’); if( isset($_COOKIE[‘qode-like_’. $post->ID]) ){ $class = ‘qode-like liked’; $title = __(‘You already like this!’, ‘qode’); } return ‘ID .'” title=”‘. $title .'”>’. $output .’‘; }

    function add_qode_like_portfolio_list(){ global $portfolio_project_id;

    $output = $this->like_post($portfolio_project_id); $class = ‘qode-like’; $title = __(‘Like this’, ‘qode’); if( isset($_COOKIE[‘qode-like_’. $portfolio_project_id]) ){ $class = ‘qode-like liked’; $title = __(‘You already like this!’, ‘qode’); } return ‘‘. $output .’‘; } }

    global $qode_like; $qode_like = new QodeLike();

    // get the ball rollin’ function qode_like() { global $qode_like; echo $qode_like->add_qode_like(); }

    function qode_like_latest_posts() { global $qode_like; return $qode_like->add_qode_like(); }

    function qode_like_portfolio_list() { global $qode_like; return $qode_like->add_qode_like_portfolio_list(); } ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • Without logging in to your WordPress admin, you can access your website files EITHER using FTP or your website management login file manager.
    This will let you repair your file.

    Thread Starter joshuat77

    (@joshuat77)

    Thanks Ross.

    I’m not quite sure what FTP is… Should I just google it?

    Yes, google would work, as would wikipedia.
    You will need an FTP program, “filezilla” has excellent features. You will find tutorials online about using it.

    However the main game here is getting your WordPress file restored, so I suggest that you login to your website hosting management (this is probably cPanel), then bring up the file manager there, you will be able to restore your file this way.

    http://codex.wordpress.org/FTP_Clients

    as you seem to be using a theme which is not from https://wordpress.org/themes/, please also consider to contact your theme’s developer for support.

    Thread Starter joshuat77

    (@joshuat77)

    I really appreciate the suggestions. I’m gonna try looking up some tutorials and look more into FTP as well.

    Thanks again guys.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Parse error: syntax error, unexpected end of file in’ is closed to new replies.