Change Content in Print View
-
I’d like to change the information shown in the print view, how can this be done?
The page I need help with: [log in to see the link]
-
That really depends how you want to change it. Some information is already there, but hidden using CSS. The CSS file is themable, so you can just replace that if you wish.
You can also pass custom templates into the print view, if you wish – that’s a bit more complicated, but it’s a possibility.
Specifically, we would like to:
Show only the time, but not he date.
Show only the street address, but no the city.It appears that this information is generated within the same CSS tags, so I’m struggling with how to accomplish this since truncation capacities of CSS are limited (to end of line, and by characters, width or lines only, it seems).
Any chance of slipping the individual pieces of information into different CSS classes so that this can be more easily customized?
What PHP file might be modified to accomplish this?
Yes, you can certainly do that. The data output is all templatable, so you could edit the title template to wrap individual pieces of information as you need.
The address information should have every address item already wrapped in individual containers, so you should be able to accomplish that with the existing data.
This would be a great way to design things, but it’s not clear that it’s actually designed that way.
Could you explain how to effectively isolate the date range from the times for instances?
Since the times are within the date-range, getting CSS to comply is particularly difficult, especially with the – being a span with no class and all.
Here’s the css highlighted:
https://drive.google.com/file/d/1mD660Mt3zXW4dNJV6prPh3fEJEVJPExw/view?usp=sharingas you can see, the mc_tb class is already set to inline-block, what you don’t see is that the daterange class is set to “display:none;”, which is apparently why the mc_tb date class is still not displaying. I tried:
.calendar .details .longdesc , .event-title a ,.calendar .details div a , .calendar .details .daterange{
display: none;
}
.calendar .details .daterange .mc_tb , .calendar .details .daterange .mc_te {
display:inline;
}The first set hides the duplicate title, and the long description, as well as the date range, while the second attempts to force the date to show.
I would love to be able to use a custom CSS “template” to make this display.
Another issues with this is that the custom folder is re-written with every plugin update, which is a hassle for maintenance.
Since you’re talking templates, I imagined (and indeed hoped) that the “Template Editor” in the plugin settings would allow editing of the Print View Template. Perhaps this is possible, but there doesn’t seem to be anything in the documentation, and the Getting started section on templates “wp-admin/admin.php?page=my-calendar-help#templates” just points to the custom folders, where I dropped the mc-print.css which I included a snippet of above.
Am I just missing something, or is the CSS indeed particularly tricky to style for this specific information?
Is there some other way to generate the HTML for the Print View via an actual Template file (rather than CSS)?The other information is the different sections of the address, specifically the City, which is redundant for events which are all in the same city.
But how could this be removed via CSS?
https://drive.google.com/file/d/1kT1S-1kZ4F_ttZHgBba3Ve7FAtJ4Wkn0/view?usp=sharingAgain, perhaps you are suggesting using an actual template file, but I haven’t been able to find any information about how to create a template file for the print view.
What is the template code that’s adding that address? It doesn’t look like it’s using the My Calendar location manager, as that manager would be wrapping each piece in a unique field. If the location is just text that’s written into a description field, then there isn’t much the My Calendar can do about that.
Looking at the date range, I can see that there’s a span missing in the source; that should be wrapped with
<span class='mc_db'>
– I’d overlooked it, because it does have that wrapper when it spans multiple dates.It’s odd that your custom folder is overwritten on plug-in updates; but in looking at the docs, I can see that they’re showing the wrong location. That should be
/{path}/wp-content/plugins/my-calendar-custom/styles/
Thanks for reporting this!
- The topic ‘Change Content in Print View’ is closed to new replies.