Inkblot: Hide the “Purchase Webcomic” Link

Those of you using Webcomic/Inkblot may have noticed that when you enter a PayPal account on the “Webcomic > Settings” page, a “Purchase Webcomic” link appears on all your webcomic posts. This is great, but can be confusing to your visitors, as it’s shown even when you’re not selling prints for a particular comic. There are two ways to have the link only appear when a comic has print selling enabled.

The easy CSS way:

If print selling isn’t enabled on a single webcomic, the purchase-webcomic-link-closed class is added to the “Purchase Webcomic” link. Just drop something like this in your CSS and you can conditionally hide the link:

.purchase-webcomic-link-closed {
    display: none;

The more complex but still fairly easy way:

If you want to completely get rid of the link rather than hide it, you can conditionally print the link by using one of Webcomic’s built-in functions to check if prints are open for a specific webcomic. Find every instance of:

purchase_webcomic_link( '%link | ' );

and replace it with:

if ( $webcomic->webcomic_prints_open() ) { purchase_webcomic_link( '%link | ' ); }

There should be four; two in index.php (lines 40 and 55), one in loop.php (line 10), and one in webcomic_home.php (line 25). You also need to add global $webcomic; to loop.php and webcomic_home.php. At the top of both of those files you should see a line with this somewhere in the middle:

global $inkblot;

Change it to:

global $inkblot, $webcomic;