mgsisk / webcomic

Comic publishing power for the web. Turn your WordPress-powered site into a comic publishing platform with Webcomic.
http://wordpress.org/plugins/webcomic
GNU General Public License v2.0
110 stars 29 forks source link

Webcomic Nav w/Selling Prints #257

Closed ghost closed 8 years ago

ghost commented 8 years ago

Firstly, happy new year!

I'm currently customising a theme at http://leylinescomic.com/ They want to sell the original art for their comic page. When the option is selected, navigation is fine. (See here: http://leylinescomic.com/leylines/c11p53-fakes/ )

When we deselect selling, all the navigation buttons float left. (http://leylinescomic.com/leylines/c11p54-something-else/)

Is there a way to mark a page as "sold" and have it display a sold image? If there is a page that isn't selling its original art, is it possible to have the navigation aligned evenly?

mgsisk commented 8 years ago

Happy New Year, @CAMorgan!

The bad news is that you'll need to edit a core Webcomic file to get this working properly. The good news is that it really ought to work this way anyway, so you shouldn't have to worry about updates messing with this change as I'm planning on making it directly to Webcomic now that you've pointed it out.

Find lines 1340–1342 in webcomic/-/php/widgets.php:

if ( $output = WebcomicTag::purchase_webcomic_link( '%link', $link, get_the_ID() ) ) {
    echo $before_widget, empty( $title ) ? '' : $before_title . $title . $after_title, $output, $after_widget;
}

And remove lines 1340 and 1342, so that only the echo… line remains:

echo $before_widget, empty( $title ) ? '' : $before_title . $title . $after_title, $output, $after_widget;

That should force the Purchase Webcomic Link widget to always output something, which will force the nav links to line up wether or not there's an actual purchase link there or not.

ghost commented 8 years ago

Thanks for the feedback! I gave it a try and nothing changed except now if I have selling original art/prints enabled it doesn't display. I cleared the cache multiple times, just in case, but no go.

mgsisk commented 8 years ago

Ah, that's entirely my fault. Just above the echo… line, try adding this:

$output = WebcomicTag::purchase_webcomic_link( '%link', $link, get_the_ID() );
ghost commented 8 years ago

Got the purchase button back now, ha, but still no alignment happening for the navigation buttons.

mgsisk commented 8 years ago

Interesting… try changing the $output… line to this:

$output = WebcomicTag::purchase_webcomic_link( '%link', $link, get_the_ID() ) ?: '<br>';
ghost commented 8 years ago

Now it works, excellent! I have a few questions about the purchase print option itself, is it ok to ask here or should I open a new thread?

mgsisk commented 8 years ago

Go ahead and open a new thread (or multiple threads); I'll close this one.