Parse error: syntax error, unexpected T_VARIABLE in
-
I’m trying to insert the following code into a post:
<?php $my_id = 1149 $post_id_1149 = get_post($my_id); $content = $post_id_1149->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; ?>
So, I entered the following into the ‘text’ field:
[insert_php] $my_id = 1149 $post_id_1149 = get_post($my_id); $content = $post_id_1149->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; [/insert_php]
The code is supposed to populate the ‘body text’ of the page with the contents of post_id_1149. The code is ‘good’ – i.e. if added to page.php it does what it is supposed to do. However, I’m trying to auto-populate the mobile version of the site using the content of the desktop version. That way, I only have to update the desktop version and the mobile version should automatically reflect any updates.
Unfortunately, I’m getting the following error:
Parse error: syntax error, unexpected T_VARIABLE in /.../plugins/insert-php/insert_php.php(48) : eval()’d code on line 3
Am I doing something wrong?
- The topic ‘Parse error: syntax error, unexpected T_VARIABLE in’ is closed to new replies.