• Hiya,

    I’m building a site using Webcomic at the moment – I’ve set up all the comics with storylines, characters etc.

    The issue I’m having is with the pagination shortcodes; I’m trying to use them to show comic strips within storyline, within character, depending on whereabouts on the site a user is.

    This is one of the shortcodes I’m using:
    [previous_webcomic_link format=”<b>%link</b>” in_same_term=”true” taxonomy=”storyline”]

    However, on the page, each of the links just links to the same comic which is currently displaying, rather than allowing the user to navigate within that storyline. e.g. http://cogdiss.com/drnew/dingus-rancher/tochikan/

    Have I misunderstood how the pagination shortcodes work?

    Cheers!

    Hannah

    https://wordpress.org/plugins/webcomic/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mike

    (@mgsisk)

    Hey Hannah! It looks like you’re using the shortcodes correctly; I’m pretty sure Webcomic is at fault. The problem (with your [previous_webcomic_link] example, at least) is the in_same_term argument. Webcomic is expecting a strict boolean value of true, but – when used as a shortcode – it’s actually getting a string “true”, which it misinterprets as something else.

    I probably won’t be able to release a proper Webcomic update until October, so here’s the fix (if you’re adventurous): open up /webcomic/-/php/tags.php and find this block of code inside the public static function get_relative_webcomic function (it starts on line 724 in my dev copy):

    if ( ( $in_same_term or $excluded_terms ) and $taxonomy ) {
    				$join    = " INNER JOIN {$wpdb->term_relationships} AS tr ON p.ID = tr.object_id INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
    				$exclude = " AND tt.taxonomy IN ( '" . implode( "', '", $taxonomy ) . "' )";
    
    				if ( true === $in_same_term and $post_id ) {
    					$include = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'ids' ) );
    				} elseif ( $in_same_term and true !== $in_same_term ) {
    					$include = is_array( $in_same_term ) ? array_map( 'intval', $in_same_term ) : array_map( 'intval', explode( ',', $in_same_term ) );
    				} else {
    					$include = array();
    				}
    
    …

    Just below the $exclude = … line, add this:

    $in_same_term = 'true' === $in_same_term ? true : $in_same_term;

    That should correct the issue for this shortcode. Are you having issues with any other shortcodes?

    Thread Starter Cogdiss

    (@cogdiss)

    Hi Mike,

    That’s great, many thanks! I’m relatively confident with editing core files, including php files, so I’ll give this a try 🙂

    This is the only thing I’ve found that isn’t working as I expected – everything else seems to be working like a charm.

    Cheers!

    Hannah

    Thread Starter Cogdiss

    (@cogdiss)

    This worked perfectly, thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trouble with pagination shortcodes’ is closed to new replies.