How to handle PHP parse errors?

You have to close the PHP context if you use raw HTML output. Instead of … <?php global $EM_Event; <div class=”content_left”> <?php gteventstore_before_loop(); ?> … close PHP before the div: <?php global $EM_Event; ?> <div class=”content_left”> <?php gteventstore_before_loop(); ?> Use an IDE with a PHP parser to see such syntax errors early. You code looks … Read more

Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ [closed]

It’s not a very good practice to echo html code. Also you have errors with quotes. Correct way to do this would be: <a href=”https://wordpress.stackexchange.com/questions/106828/mailto:type%20email%20address%20here?subject=I%20wanted%20to%20share%20this%20post%20with%20you%20from%20<?php echo rawurlencode(get_bloginfo(“name’)); ?>&body=<?php echo rawurlencode(get_the_title()); ?>%20%20%3A%20%20<?php echo rawurlencode(get_the_excerpt()); ?>%20%20%2D%20%20%28%20<?php echo rawurlencode(get_permalink()); ?>%20%29″ title=”Email to a friend/colleague” target=”_blank”>Share via Email</a>

Parse error: syntax error, unexpected T_FUNCTION

That is called an Anonymous Function and is only supported in later versions of PHP, specifically 5.3.0 and later. If I were a betting man I would say your server has an earlier version of PHP. Try this instead: /*Add meta boxes to contact page*/ function contact_metaboxes( \WP_Post $post ) { global $post; if( ! … Read more

Printing out JSON array returned [closed]

Setting the proper dataType for the request is an important detail not considered in the answer above (this causes jQuery to send a HTTP Accept header with the request – and it will be expecting JSON data in the success callback as well): dataType: ‘json’, success:function(json){ var content=””; jQuery.each(json, function(i, v){ content += ‘<li>’ + … Read more

Function code problem

If the code above is how it is in your actual theme file, there are obvious errors (maybe it didn’t post right here). Here is the fixed code: <?php add_filter(‘post_type_link’, ‘my_permalink_structure’, 10, 4); function my_permalink_structure($post_link, $post, $leavename, $sample) { if ( false !== strpos( $post_link, ‘%states%’ ) ) { $term = get_the_terms( $post->ID, ‘states’ ); … Read more