WPIntell

Source evidence

[Plugin: Per Page Sidebars] Per Post Sidebars?

Per Page Sidebars · support · 2011-01-11T14:49:00+00:00

complaintsentiment
highseverity
1.0relevance
15replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

6 / 31 rows with source links

19.4% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

25 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
patricktessels unresolved
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/ Thanks for the input. I’ll see what I can do. Hi Brian Really useful plugin thank you I agree with Patrick – would be useful to extend to posts as well as pages. Thank you 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. 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. 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 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' ); } 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. 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' ); } 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. 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' ); } } 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? I don’t have a menu option like that either, I think it’s old documentation. Look in your widgets page. 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? 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. Ahhh… OK, I see. That’s not how I was expecting it to work, but that’s good. Thanks so much for your help!

Comments

15 shown
Brian Layman 2011-01-18T06:12:00+00:00

Thanks for the input. I’ll see what I can do.

stuartwarner 2011-01-18T11:04:00+00:00

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 2011-01-19T21:42:00+00:00

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 2011-01-19T21:50:00+00:00

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 2011-04-24T20:47:00+00:00

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 2011-04-24T20:56:00+00:00

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 2011-04-24T20:59:00+00:00

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 2011-04-24T21:02:00+00:00

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 2011-04-24T21:04:00+00:00

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 2011-04-24T21:51:00+00:00

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 2011-04-24T22:12:00+00:00

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 2011-04-24T22:14:00+00:00

I don’t have a menu option like that either, I think it’s old documentation. Look in your widgets page.

toddheitner 2011-04-24T22:19:00+00:00

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 2011-04-24T22:20:00+00:00

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 2011-04-24T22:24:00+00:00

Ahhh… OK, I see. That’s not how I was expecting it to work, but that’s good. Thanks so much for your help!