PHP error - PRO child theme functions.php

UPDATE: I solved this problem. I remembered to set theme to full width with sidebar to the right and… problem solved!

In an attempt to fix a theme issue, I un-installed both PRO and PRO child theme, downloaded latest zip files, re-installed both, set child theme as active then went to reinsert the custom function I was given by one of the amazing Themeco staff a year or so ago. The function’s purpose was to make it so the sidebar is displayed on posts only:

add_sidebar_post($layout) {
if(is_singular(‘post’)) {
$layout = "content-

sidebar";
}
return $layout;
}

add_filter(‘x_option_x_layout_content’, ‘add_sidebar_post’,9999);

The custom function was working perfectly until I re-installed the themes.

Now, upon adding the custom function to the functions.php of the PRO child theme, I get this PHP error:

Your PHP code changes were rolled back due to an error on line 27 of file wp-content/themes/pro->child/functions.php. Please fix and try saving again.

syntax error, unexpected ‘if’ (T_IF)

How can we get this functionallity working again?

Hello There,

The correct code should be:

add_sidebar_post($layout) {
  if(is_singular('post')) { 
    $layout = "content-sidebar";
  }
  return $layout;
}
add_filter('x_option_x_layout_content', 'add_sidebar_post',9999);

If you need anything else we can help you with, please let us know.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.