Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I get this error when I enter data in my form

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in

\functions.php on line 77

return '<span class="vwbx">Views</span>''<span class="vwbx">$count.</span>';

==== Whole function===

function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
    return "0 View";
}
return $count. '<span class="vwbx">Views</span>''<span class="vwbx">views</span>';
}
share|improve this question
add comment

closed as too localized by toscho Jun 15 '13 at 11:55

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 1 down vote accepted

The problem is that you have two strings that aren't actually being appended together.

Try replacing

return $count. '<span class="vwbx">Views</span>''<span class="vwbx">views</span>';

With

return $count. '<span class="vwbx">Views</span>'.'<span class="vwbx">views</span>';

(note the added period in the centre).

Or instead, remove the two quotation marks from the centre:

return $count. '<span class="vwbx">Views</span><span class="vwbx">views</span>';

That should work :D

EDIT In response to your comment... I think you'll be wanting to replace it with:

return '<span class="vwbx">Views</span><span class="bxarw"></span><span class="CntBx">'.$count.'</span>';
share|improve this answer
    
thanks Harris working but i need to do this, to get $count value like return '<span class="vwbx">Views</span><span class="bxarw"></span><span class="CntBx">$count.</span>'; –  user8503 Jan 18 '12 at 14:23
1  
I've edited my answer :D. By the way, you may want to start accepting answers to your questions - your score is very low and people may decide not to bother answering you. –  Stephen Harris Jan 18 '12 at 14:27
    
thanks Harris :) –  user8503 Jan 18 '12 at 14:32
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.