in_webcomic_storyline

Summary:

A shortcut function for WordPress’ own is_object_in_term(). Checks if a post is in the specified storyline.

Tag and base function call:

function in_webcomic_collection( $terms = false, $id = false ) {
    global $webcomic; return $webcomic->in_webcomic_term( 'webcomic_collection', $terms, $id );
}

Examples:

<?php
if ( in_webcomic_storyline( 47 ) )
    echo 'Yup. The current comic is in the storyline with ID=47.';
?>
<?php
if ( in_webcomic_storyline( array( 'banana_stories', 'salmon' ) ) )
    echo 'Yup. The current comic is in a storyline that has "banana_stories" or "salmon" as its slug.';
?>
<?php
if ( in_webcomic_collection( 'The Banana Man' ) )
    echo 'Yup. The current comic is in a storyline with the name "The Banana Man".';
?>
<?php
if ( in_webcomic_collection( 47, 3 ) )
    echo 'Yup. The comic post with ID=3 is in the webcomic storyline with ID=47.';
?>

Arguments

  • terms (str|int|array) technically optional
    The terms (storyline) to check for.
    default: false; can be the storyline slug, name, or ID or an array of such.
  • id (int) optional
    The ID of the post you wish to check. If false, uses current post ID.
    default: false; can be any integer.
Share
Facebook Twitter Digg Stumble Delicous Email