Exclude sidebar and header from printing
-
Hi, can you please provide a stylesheet to customize print layout?
I want to exclude header and sidebar from print layout.I tried this one https://codex.wordpress.org/Styling_for_Print
but doesn’t work.
Thank you in advance.The page I need help with: [log in to see the link]
-
Hi @readonecc,
You can use “Inspect Element” tools on the browser. Please follow the steps explained in this link: https://www.greengeeks.com/tutorials/article/use-the-inspect-element-tool-in-chrome/.
CSS Tutorial: https://www.w3schools.com/css/
CSS Units: https://www.w3schools.com/cssref/css_units.aspPut your CSS on print style:
@media print { /* put you CSS here */ }Best Regards
Hi, thank you for your information.
I successfully add the code and remove the sidebar, but the sidebar area still included while printing, I want to make it full screen.
This is my code:@media print { a[href]:after { content: none !important; } #footer, #header, #sidebar-primary, #right-sidebar, #site-header-inner, #scroll-top, #sidebar { display:none !important; } }and this is the result:
https://drive.google.com/file/d/10a_Hb-MfhEzKFOo25EjmZZ5VN-A_sobQ/view?usp=sharingI also tried to exclude breadcumb for being printed but I can not find the element ID.
Thank you
-
This reply was modified 4 years, 9 months ago by
Mohammad Ridwanullah.
Hi, the problem solved by these codes
@media print { a[href]:after { content: none !important; } #footer, #header, #sidebar-primary, #right-sidebar, #site-header-inner, #scroll-top, #sidebar { display:none !important; } /*Remove Sidebar Container*/ .content-area { float: left; position: relative; width: 100%; margin-top: 50px; padding-left: 10px; padding-right: 10px; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-width: 1px; border-style: solid; border-color: #f1f1f1; } .page-header, .has-transparent-header .page-header { display: none;} }I am now finding the css settings to setup the top and bottom margin, if you have information regarding this please provide me that. thank you
I want to add more space here.
https://drive.google.com/file/d/1FvbkZjvmyFxggtYUjr3Swd2WdxBcrknu/view?usp=sharing
Hello @readonecc,
I’m glad it is solved.
Regarding the second page on the printing, I’m not sure perhaps you can manage it on the print settings or using the “body” class; like@media print { body.page { margin: 100px 0; } }Best Regards
Thank you @skalanter, it works like charm.
I have more problem if you don’t mind,
I tried to use ocean stick anything to make my sidebar sticky, but it make an empty blank page after the last page, I tried to find the element but no luck, and I removed the stick anything plugin.If you have any information about this please provide me it, I need to make the sidebar sticky but I don’t want to add an empty page to the print layout.
Thank you.
Hello @readonecc,
You’re welcome.
I’m glad it is solved.Regarding your “Ocean Stick Anything” plugin issue, I need to know the steps to replicate it.
Also, could you please share a live URL from your issue or share screenshots?You can upload your files to one of the following online services:
- https://postimages.org
- https://imgbb.com
- https://www.loom.com
- https://drive.google.com
- https://www.dropbox.com
Sending a live URL and screenshots of your issues would be helpful for faster support.
________
For troubleshooting, please do the following steps and let me the results:
1- Head over to WP Dashboard > Plugin.
2- Deactivate all plugins.
3- Then, first activate the Ocean Extra plugin.
4- Check your issue.
5- Then, activate your plugins one by one
6- After activation of any plugins, check your issueNote: if you have a cache plugin or server cache. You need to clear its cache contents or disable them.
Best Regards
-
This reply was modified 4 years, 9 months ago by
The topic ‘Exclude sidebar and header from printing’ is closed to new replies.
