Shortcode?
-
So far, from initial testing, it looks to be a nice plugin. I would like to be able to use a shortcode to allow PDF output only for the pages I want it on. Is that possible?
https://www.ads-software.com/plugins/wp-post-to-pdf-enhanced/
-
Currently, you need to specify pages to include or exclude in the admin dialog. I do plan to implement shortcodes, however, so stay tuned for this feature (likely by version 1.1).
In my own setup, I want the ability to generate pdfs on most pages, so I have an exclude list specified. However, I could see where the reverse might be true. This is logic inherited from the original plugin, and I haven’t had time to re-think it.
Cheers
Lewis
I am trying to produce basic product documentation, e.g., installation instructions. Pages are created and then duplicated and edited for specific product variations. Shortcode is the preferred method, as this will be authors/editors and not administrators who edit the pages.
I just sent an e-mail on your website with a bit more information.
Hi, Ellyn!
This afternoon, I landed the initial shortcode feature on trunk. If you’d care to test, you may update your existing wp-post-to-pdf-enhanced.php (and readme.txt) and add wpptopdfenh_shortcodes.php to the main plugin directory.
The shortcode is [wpptopdfenh] and you may place it anywhere in the post/page where you would like the icon/PDF link to appear, and it will obey paragraph formatting (right/left, etc.)
The plugin ignores include/exclude directives set in the admin panel, except for the single page option and the public option.
Please test and report your findings.
Still to implement for this: options for the shortcode (fonts, etc.), different/no icon image, and additional shortcodes for PDF formatting (manual page breaks, etc.).
Enjoy!
shortcode-as-a-widget works perfectly for me
functions.php
// allow shortcodes in widgets add_filter('widget_text', 'do_shortcode');
text widget
[wpptopdfenh]
Let me know if there’s anything specific to test. I’m not really sure how to properly check out things with subversion. I just installed subversion and did
sudo svn co https://plugins.svn.www.ads-software.com/wp-post-to-pdf-enhanced/trunk/
sudo mv trunk wp-post-to-pdf-enhanced
Hi Lewis,
I am not having any luck, after downloading and installing the files you mentioned. For example, if you go to the home page and click on the PDF, the following is returned: https://dslocks-hoc.pitlarson.com/?format=pdf
Here is the system info in case it helps:
WP Version: 3.8
WP Multisite Enabled: No
Web Server Info: Apache
PHP Version: 5.4.22
MySQL Version: 5.5.35-logSorry for the late follow-up:
Alex – I’m interested in various paragraph formatting options and include/exclude combinations in the admin area, to make sure that the icon shows up where we want it and on which page/post.
Ellyn – I will have a look right now. I might expect that from a preview of a post, as we need a permalink to generate the pdf. The result posted indicates the lack of a permalink, and thus, an invalid url passed to TCPDF. I’ll know more when I look more closely.
Thanks for the feedback!
Okay, Ellyn, I see the problem. It’s an include/exclude thing, which is exactly what we’re testing. If I specifically include page 5 (what you are using as the home page), then both the default icon and the shortcode generate the pdf as expected. If I remove that page from the inclusion list, then I get a return false, which re-renders the original page (sans the icon, which indicates that the shortcode is working, and my logic is flawed – LOL).
Let me see what I can do to tweak the logic, here, and I’ll follow up later on.
Thanks again for testing!!
Lewis
Version 2 of the patch going to svn shortly. If this works, the final version will incorporate these changes and some streamlined code for the initial change (which was rather ugly before, IMO).
This patch does the following:
If we detect a shortcode on the page, we skip the checks for excluding pdf generation for the given page. (Originally, I was only checking for the inclusion/exclusion for displaying the icon, not creating the content.) I think I have one more tweak to make after this, however, as we need to factor in the setting for caching (i.e., if we have included the page for caching, but excluded it for showing the icon, we’ll want to fetch the cached version of the page, assuming it has not expired).
Stand by, and please check for an updated wp-post-to-pdf-enhanced.php shortly!
Alex – Re: Subversion – While I host a Subversion repo for an organization, I am by no means an expert. You might want to have a look at SmartSVN from WAN Disco. It’s Java-based, so it runs on just about everything, and I find that the GUI makes things a whole lot easier for things I don’t do all the time.
Cheers
Good to hear you have thought about the caching. In my view, having an option in the shortcode for caching would be great.
Ah, that’s not exactly what I was discussing, but it’s something I should add to my “shortcode feature list.”
I was referring to the admin option for including/excluding pages from the pdf cache. I want to make sure that when we request the pdf from the shortcode, while we ignore the include/exclude pdf generation options for that page, we obey the caching option set.
The feature you mention is a good override, though, as it should allow us to specifically bypass a cached version for a fresh one, e.g., [wpptopdfenh cached=”no”], so that even if a cached version exists, we force a refresh from the shortcode.
Other shortcode modifiers on my list include:
icon=”path-to-different-icon-image”
link=”text” | “icon” to override the default setting, and where “text” is any string you’d like, such as, “click here for PDF” or “download this as PDF”
header-logo=”off” | “on” to override the visibility of the header logo image
logo=”path-to-different-header-logo-image”and of course, the various font overrides. ??
Sounds good. I’d like to test out the logo image path when you have it, because for some reason, I’ve never been able to get this to work from my wp-content/uploads directory.
Hi elarson
I think you may have to remove the alpha layer from the png logo you wish to use – often this helps.
You can use GIMP to remove the alpha layer.
hi Lewis
Just getting into the swing of things thanks for the help.
The commands that work well for me are
mkdir wp-post-to-pdf-enhanced cd wp-post-to-pdf-enhanced sudo svn co https://plugins.svn.www.ads-software.com/wp-post-to-pdf-enhanced/trunk/ . svn info
I’m on Revision 830443 if that helps.
Alignment seems to work well (link).
In my case, PNG logo only works when there is no alpha channel not sure if that’s particular to me or not. I guess that’s due to the TCPDF.
V minor issue: it doesn’t seem to reproduce paragraph indentation create from the wordpress visual editor. See paragraph starting “Vestibulum blandit, eros eu facilisis aliquet” here. Another TCPDF prob perhaps. Everything else topography style wise looks preeetty good.
- The topic ‘Shortcode?’ is closed to new replies.