Title: [Plugin: Per Page Sidebars] Per Post Sidebars?
Last modified: August 19, 2016

---

# [Plugin: Per Page Sidebars] Per Post Sidebars?

 *  [patricktessels](https://wordpress.org/support/users/patricktessels/)
 * (@patricktessels)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/)
 * Could you maybe implement the functionality to also get custom sidebars per post?
   That would be really handy.
 * [http://wordpress.org/extend/plugins/per-page-sidebars/](http://wordpress.org/extend/plugins/per-page-sidebars/)

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [Brian Layman](https://wordpress.org/support/users/brianlayman/)
 * (@brianlayman)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856417)
 * Thanks for the input. I’ll see what I can do.
 *  [stuartwarner](https://wordpress.org/support/users/stuartwarner/)
 * (@stuartwarner)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856420)
 * Hi Brian
 * Really useful plugin thank you
 * I agree with Patrick – would be useful to extend to posts as well as pages.
 * Thank you
 *  [ItsDan](https://wordpress.org/support/users/itsdan/)
 * (@itsdan)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856423)
 * Also agree. I’ve tried adding the functionality myself, I enabled the meta box
   to appear on posts. It’s saving that data, the new sidebar shows up in the widgets
   page. For some reason it’s still showing the default sidebar, but I’m sure I’m
   missing something small. “Official” support for this would be nicer.
 *  [ItsDan](https://wordpress.org/support/users/itsdan/)
 * (@itsdan)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856424)
 * Posted too soon, it was working fine I just had the wrong sidebar to replace 
   selected. So all I did was:
 * in: pps_reg_custom_sidebar():
    if ( is_page() ) { to if ( is_page() || is_single()){
 * in: pps_save_postdata():
    if ((‘page’ == $_POST[‘post_type’] ) and current_user_can(‘
   edit_theme_options’)) { to if ((‘page’ == $_POST[‘post_type’] || ‘post’ == $_POST[‘
   post_type’] ) and current_user_can(‘edit_theme_options’)) {
 * and in: pps_add_custom_box():
    if ( current_user_can(‘edit_theme_options’) ) {
   add_meta_box(‘pps_sectionid’, __( ‘Custom Sidebar’, ‘tcc_pps_domain’ ), ‘pps_inner_custom_box’,‘
   page’, ‘advanced’, ‘high’ ); }
 * to:
 * if ( current_user_can(‘edit_theme_options’) ) {
    add_meta_box(‘pps_sectionid’,
   __( ‘Custom Sidebar’, ‘tcc_pps_domain’ ), ‘pps_inner_custom_box’, ‘page’, ‘advanced’,‘
   high’ ); add_meta_box(‘pps_sectionid’, __( ‘Custom Sidebar’, ‘tcc_pps_domain’),‘
   pps_inner_custom_box’, ‘post’, ‘advanced’, ‘high’ ); }
 * Not sure if that helps anyone. Neat plugin, I just finished a site which had 
   a different plugin per page. Couldn’t find this at first and was going to try
   and write one that integrated the widget editor on the post page itself, but 
   this is SO much easier and less prone to fault.
 *  [toddheitner](https://wordpress.org/support/users/toddheitner/)
 * (@toddheitner)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856501)
 * I tried replacing the code per the previous post but it’s causing an error for
   me:
 * Parse error: syntax error, unexpected $end in /wp-content/plugins/per-page-sidebars/
   per-page-sidebars.php on line 231
 *  [toddheitner](https://wordpress.org/support/users/toddheitner/)
 * (@toddheitner)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856502)
 * Ok, I figured out what was generating the error. It was the last section of code
   replacement. It added an opening bracket { where there wasn’t one in the original
   code.
 * It should be like this:
    REPLACE THIS:
 *     ```
       if ( current_user_can('edit_theme_options') )
       		add_meta_box('pps_sectionid', __( 'Custom Sidebar', 'tcc_pps_domain' ), 'pps_inner_custom_box', 'page', 'advanced', 'high' );
       }
       ```
   
 * WITH THIS:
 *     ```
       if ( current_user_can('edit_theme_options') )
       		add_meta_box('pps_sectionid', __( 'Custom Sidebar', 'tcc_pps_domain' ), 'pps_inner_custom_box', 'page', 'advanced', 'high' );
       		add_meta_box('pps_sectionid', __( 'Custom Sidebar', 'tcc_pps_domain' ), 'pps_inner_custom_box', 'post', 'advanced', 'high' );
       }
       ```
   
 *  [ItsDan](https://wordpress.org/support/users/itsdan/)
 * (@itsdan)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856503)
 * Todd, thanks for the info but I’m not sure you’re correction has it right. There
   should definately be an opening bracket at the end of the line beginning with‘
   if’. There may be a missing closing bracket above that line though.
 *  [toddheitner](https://wordpress.org/support/users/toddheitner/)
 * (@toddheitner)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856504)
 * I would think so too, but that’s where the error seems to be coming from. Here
   is the code from the original, unedited function:
 *     ```
       function pps_add_custom_box() {
       	// This security check is also verified upon save.
       	if ( current_user_can('edit_theme_options') )
       		add_meta_box('pps_sectionid', __( 'Custom Sidebar', 'tcc_pps_domain' ), 'pps_inner_custom_box', 'page', 'advanced', 'high' );
       }
       ```
   
 *  [ItsDan](https://wordpress.org/support/users/itsdan/)
 * (@itsdan)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856505)
 * The ‘unexpected end’ error can be misleading with the line number, it can only
   determine where it became certain the brackets weren’t open/closed correctly.
   The error has to be above that line, as posted the 2nd add_meta_box function 
   call would not be conditional. This would likely work it would just add the metabox
   to users who can’t otherwise “edit_theme_options”, but I would still bet on it
   missing from code above that line.
 *  [toddheitner](https://wordpress.org/support/users/toddheitner/)
 * (@toddheitner)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856506)
 * Well, it was definitely that section that caused the error. Line 231 is the last
   line of the file: ?>
 * But you’re right, there should be an opening bracket. There just wasn’t one in
   the original file, so you need to add both an opening and closing bracket for
   the IF statement.
 * So the function should look like this:
 *     ```
       function pps_add_custom_box() {
       	// This security check is also verified upon save.
       	if ( current_user_can('edit_theme_options') ){
       		add_meta_box('pps_sectionid', __( 'Custom Sidebar', 'tcc_pps_domain' ), 'pps_inner_custom_box', 'page', 'advanced', 'high' );
       		add_meta_box('pps_sectionid', __( 'Custom Sidebar', 'tcc_pps_domain' ), 'pps_inner_custom_box', 'post', 'advanced', 'high' );
       	}
       }
       ```
   
 *  [toddheitner](https://wordpress.org/support/users/toddheitner/)
 * (@toddheitner)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856507)
 * Now I’m running into a different issue. According to the plugin’s installation
   instructions, it says there should be a new menu option for the plugin under 
   Settings > Per Page Sidebar. However, I’m not seeing that.
 * Just in case some of my changes messed something up, I reverted to the original
   files and there still is no menu option.
 * When I go to a page I have a checkbox for using a custom sidebar, as well as 
   radio buttons for which sidebar to replace, but there is nowhere to specify what
   appears in the custom sidebar, either on the screen where you edit the page or
   anywhere in the menus.
 * I’m using the latest version of WordPress, version 3.1.1. Is it not compatible?
 *  [ItsDan](https://wordpress.org/support/users/itsdan/)
 * (@itsdan)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856508)
 * I don’t have a menu option like that either, I think it’s old documentation. 
   Look in your widgets page.
 *  [toddheitner](https://wordpress.org/support/users/toddheitner/)
 * (@toddheitner)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856509)
 * I’ve looked in the widgets page but there’s nothing new there. It seems to be
   just the standard stuff. What should I be seeing?
 *  [ItsDan](https://wordpress.org/support/users/itsdan/)
 * (@itsdan)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856510)
 * If you’ve enabled a custom sidebar on a post/page you’ll see a new sidebar with
   the format pps-{slug} where slug is from the page you enabled custom sidebars
   for.
 *  [toddheitner](https://wordpress.org/support/users/toddheitner/)
 * (@toddheitner)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856511)
 * Ahhh… OK, I see. That’s not how I was expecting it to work, but that’s good. 
   Thanks so much for your help!

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘[Plugin: Per Page Sidebars] Per Post Sidebars?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/per-page-sidebars.svg)
 * [Per Page Sidebars](https://wordpress.org/plugins/per-page-sidebars/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/per-page-sidebars/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/per-page-sidebars/)
 * [Active Topics](https://wordpress.org/support/plugin/per-page-sidebars/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/per-page-sidebars/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/per-page-sidebars/reviews/)

 * 15 replies
 * 5 participants
 * Last reply from: [toddheitner](https://wordpress.org/support/users/toddheitner/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-per-page-sidebars-per-post-sidebars/#post-1856511)
 * Status: not resolved