Below, you’ll find a detailed guide on how to add the Comic Easel Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Comic Easel Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Comic Easel Plugin and the shortcodes it provides:
"Comic Easel is a dynamic WordPress plugin designed to make comic publishing seamless. With this plugin, comic creators can easily manage, organize, and display their creative works."
- [cast-page]
- [comic-archive]
- [transcript]
- [buycomic]
- [comic-archive-dropdown]
- [randcomic]
Comic Easel [cast-page] Shortcode
The Comic Easel plugin shortcode, ‘cast-page’, generates a character list or a single character display. It allows customization by setting parameters like ‘character’, ‘limit’, ‘order’, ‘stats’, ‘image’, and ‘chapter’. If ‘chapter’ is set, it fetches the character list of that chapter. Otherwise, it retrieves all characters or a single one if ‘character’ is specified.
Shortcode: [cast-page]
Parameters
Here is a list of all possible cast-page shortcode parameters and attributes:
character
– Defines specific character to be displayed.limit
– Sets maximum number of characters to show.order
– Determines order of characters, ‘desc’ for descending, ‘asc’ for ascending.stats
– If set to 1, character statistics will be shown.image
– If set to 1, character image will be displayed.chapter
– If set to 1, displays characters from specific chapter.
Examples and Usage
Basic example – Display a list of all characters in descending order based on count.
[cast-page /]
Advanced examples
Display a list of all characters in ascending order based on count, but limit the number of characters displayed to 5.
[cast-page limit="5" order="asc" /]
Display the details of a single character by referencing the character’s slug.
[cast-page character="superman" /]
Display a list of characters from a specific chapter by referencing the chapter’s ID, and include the characters’ images but not their stats.
[cast-page chapter="1" stats="0" image="1" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [cast-page]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('cast-page', 'ceo_cast_page');
Shortcode PHP function:
function ceo_cast_page( $atts, $content = '' ) {
extract( shortcode_atts( array(
'character' => '',
'limit' => '',
'order' => 'desc',
'stats' => 1,
'image' => 1,
'chapter' => 0
), $atts ) );
$cast_output = '';
if ($chapter) {
$character_list = ceo_get_character_list($chapter);
$cast_output .= '<table class="cast-wrapper">'."\r\n";
foreach ($character_list as $character) {
$character_object = get_term_by('slug', $character->tag, 'characters');
$cast_output .= ceo_cast_display($character_object, $stats, $image)."\r\n";
}
$cast_output .= '</table>'."\r\n";
return $cast_output;
}
if (empty($character)) {
if ($limit) {
$args = 'orderby=count&order='.$order.'&hide_empty=1&number='.$limit;
} else $args = 'orderby=count&order='.$order.'&hide_empty=1';
$characters = get_terms( 'characters', $args );
if (is_array($characters)) {
$cast_output .= '<table class="cast-wrapper">'."\r\n";
foreach ($characters as $character) {
$cast_output .= ceo_cast_display($character, $stats, $image)."\r\n";
}
$cast_output .= '</table>'."\r\n";
} else {
$cast_output = __('You do not have any characters yet.','comiceasel')."<br />\r\n";
}
} else {
$single_character = get_term_by('slug', $character, 'characters');
if (!empty($single_character)) {
$cast_output .= '<table class="cast-wrapper">'."\r\n";
$cast_output .= ceo_cast_display($single_character, $stats, $image)."\r\n";
$cast_output .= '</table>'."\r\n";
} else
$cast_output .= __('Unknown Character:', 'comiceasel').' '.$character."<br />\r\n";
}
return $cast_output;
}
Code file location:
comic-easel/comic-easel/functions/shortcodes.php
Comic Easel [comic-archive] Shortcode
The Comic Easel plugin shortcode, ‘comic-archive’, is designed to display comic archives in different styles. This shortcode uses parameters like ‘list’, ‘style’, ‘chapter’, ‘thumbnail’, and ‘order’ to customize the output. Depending on the ‘list’ value, it can display archives by chapter thumbnails, all years, a specific year, a series, or all comics. The ‘order’ parameter defines the sequence of comics.
Shortcode: [comic-archive]
Parameters
Here is a list of all possible comic-archive shortcode parameters and attributes:
list
– Determines the type of comic archive list to displaystyle
– Not used in this shortcode functionchapter
– Specifies a particular chapter to display in archivethumbnail
– Controls whether to show comic thumbnails in archive listorder
– Sets the order of comics in archive, ‘ASC’ for ascending, ‘DESC’ for descending
Examples and Usage
Basic example – Use the ‘comic-archive’ shortcode to display a list of all comic archives in ascending order.
[comic-archive list=0 order='ASC' /]
Advanced examples
Display a list of comic archives by chapter with thumbnails in descending order. If the chapter is not found, it will display all comic archives.
[comic-archive list=4 chapter=1 thumbnail=1 order='DESC' /]
Display a list of comic archives by year with thumbnails in ascending order. If the chapter is not found, it will display all comic archives.
[comic-archive list=2 chapter=1 thumbnail=1 order='ASC' /]
Display a list of comic archives by series with thumbnails. If the series is not found, it will display all comic archives.
[comic-archive list=1 thumbnail=1 /]
Display a list of all comic archives by all years with thumbnails in descending order. If the chapter is not found, it will display all comic archives.
[comic-archive list=3 chapter=1 thumbnail=1 order='DESC' /]
PHP Function Code
In case you have difficulties debugging what causing issues with [comic-archive]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('comic-archive', 'ceo_comic_archive_multi');
Shortcode PHP function:
function ceo_comic_archive_multi( $atts, $content = '' ) {
extract( shortcode_atts( array(
'list' => 0,
'style' => 0,
'chapter' => 0,
'thumbnail' => 0,
'order' => 'ASC'
), $atts ) );
$output = '';
switch ($list) {
case 4:
$output = ceo_archive_list_by_chapter_thumbnails($order);
break;
case 3:
$output = ceo_archive_list_by_all_years($thumbnail, $order, $chapter);
break;
case 2:
$output = ceo_archive_list_by_year($thumbnail, $order, $chapter);
break;
case 1:
$output = ceo_archive_list_series($thumbnail);
break;
case 0:
default:
if ($chapter) {
$output = ceo_archive_list_single($chapter, $order, $thumbnail);
} else {
$output = ceo_archive_list_all($order, $thumbnail);
}
break;
}
wp_reset_postdata();
return $output;
}
Code file location:
comic-easel/comic-easel/functions/shortcodes.php
Comic Easel [transcript] Shortcode
The Comic Easel plugin shortcode ‘transcript’ displays comic transcripts. It extracts ‘display’ attributes, returning the transcript in a styled format.
Shortcode: [transcript]
Parameters
Here is a list of all possible transcript shortcode parameters and attributes:
display
– Specifies the style of the transcript display
Examples and Usage
Basic example – The following shortcode displays the transcript with default styling.
[transcript /]
Advanced examples
In this advanced example, we are modifying the display style of the transcript by changing the default ‘styled’ attribute to ‘plain’. This will render the transcript without any additional styling.
[transcript display='plain' /]
In another advanced example, we are using the shortcode to display the transcript only on comic posts. This will override the default behavior of not displaying transcripts in comic posts.
[transcript display='styled' enable_transcripts_in_comic_posts=true /]
PHP Function Code
In case you have difficulties debugging what causing issues with [transcript]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('transcript', 'ceo_display_transcript');
Shortcode PHP function:
function ceo_display_transcript($atts, $content = null) {
extract( shortcode_atts( array(
'display' => 'styled'
), $atts ) );
if (is_archive() || is_search() || ceo_pluginfo('enable_transcripts_in_comic_posts')) return;
return ceo_the_transcript($display);
}
Code file location:
comic-easel/comic-easel/functions/shortcodes.php
Comic Easel [buycomic] Shortcode
The Comic Easel shortcode ‘buycomic’ facilitates comic purchases on a WordPress site. It allows users to buy prints or originals, using PayPal for transactions. The code displays the comic’s ID, title, print status, and original status. It also shows the comic’s availability and price. If a comic is available, a ‘Buy Now’ button is displayed, otherwise, a status image (Sold, Out Of Stock, Not Available) appears.
Shortcode: [buycomic]
Parameters
Here is a list of all possible buycomic shortcode parameters and attributes:
character
– sets a specific character for the comicthanks
– customizes the thank you message after purchasecancelled
– customizes the message for cancelled transactions
Examples and Usage
Basic example – Displaying the buy comic form for a specific comic by referencing the comic ID.
[buycomic id=5 /]
Advanced examples
Displaying the buy comic form with custom messages for successful purchase and cancelled transaction.
[buycomic id=5 thanks="Your purchase was successful! Thank you!" cancelled="Transaction was cancelled." /]
Displaying the buy comic form with a specific character and custom messages for successful purchase and cancelled transaction.
[buycomic character="Superman" id=5 thanks="Your purchase was successful! Thank you!" cancelled="Transaction was cancelled." /]
PHP Function Code
In case you have difficulties debugging what causing issues with [buycomic]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('buycomic', 'ceo_display_buycomic');
Shortcode PHP function:
function ceo_display_buycomic( $atts, $content = '' ) {
global $post;
extract(shortcode_atts( array(
'character' => '',
'thanks' => __('Thank you for the purchase!','comiceasel'),
'cancelled' => __('You have cancelled the transaction.','comiceasel')
), $atts ) );
$buy_output = '';
if (isset($_REQUEST['id'])) $comicnum = intval($_REQUEST['id']);
if (isset($_REQUEST['action'])) {
$action = esc_attr($_REQUEST['action']);
switch ($action) {
case 'thankyou':
$buy_output .= '<div class="buycomic-thankyou">';
$buy_output .= $thanks;
$buy_output .= '</div>';
break;
case 'cancelled':
$buy_output .= '<div class="buycomic-cancelled">';
$buy_output .= $cancelled;
$buy_output .= '</div>';
break;
}
}
if (isset($comicnum)) {
$buy_print_orig_amount = get_post_meta($comicnum , 'buy_print_orig_amount', true);
if (empty($buy_print_orig_amount)) $buy_print_orig_amount = ceo_pluginfo('buy_comic_orig_amount');
$buy_print_amount = get_post_meta($comicnum , 'buy_print_amount', true);
if (empty($buy_print_amount)) $buy_print_amount = ceo_pluginfo('buy_comic_print_amount');
$buyprint_status = get_post_meta($comicnum , 'buyprint-status', true);
if (empty($buyprint_status)) $buyprint_status = __('Available','comiceasel');
$buyorig_status = get_post_meta($comicnum , 'buyorig-status', true);
if (empty($buyorig_status)) $buyorig_status = __('Available','comiceasel');
ceo_protect();
$post = get_post($comicnum); // Get the post
if (!is_wp_error($post) && !empty($post)) { // error check make sure it got a post
$buy_output .= __('Comic ID','comiceasel').' #'.$comicnum."<br />\r\n";
$buy_output .= __('Title:','comiceasel').' '.get_the_title($post)."<br />\r\n";
if (ceo_pluginfo('buy_comic_sell_print')) {
$buy_output .= __('Print Status:','comiceasel').' '.$buyprint_status."<br />\r\n";
}
if (ceo_pluginfo('buy_comic_sell_original')) {
$buy_output .= __('Original Status:','comiceasel').' '.$buyorig_status."<br />\r\n";
}
$buy_output .= "<br />\r\n";
$buy_output .= '<table class="buytable" style="width:100%;">';
$buy_output .= '<tr>';
// buy print
if (ceo_pluginfo('buy_comic_sell_print')) {
$buy_output .= '<td align="left" valign="top" style="width:50%;">';
$buy_output .= '<div class="buycomic-us-form">';
$buy_output .= '<h4 class="buycomic-title">Print</h4>';
$buy_output .= '$'.$buy_print_amount.'<br />';
if ($buyprint_status == __('Available','comiceasel')) {
$buy_output .= '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
$buy_output .= '<input type="hidden" name="add" value="1" />';
$buy_output .= '<input type="hidden" name="cmd" value="_cart" />';
$buy_output .= '<input type="hidden" name="notify_url" value="'.home_url().'/?ceopaypalipn">';
$buy_output .= '<input type="hidden" name="item_name" value="'.__('Print','comiceasel').' - '.get_the_title($post->ID).' - '.$post->ID.'" />';
// Say a thank you and that transaction went through with an action
$url = ceo_pluginfo('buy_comic_url');
$url_and = (strpos($url,'?')) ? $url.'&' : $url.'?';
$buy_output .= '<input type="hidden" name="return" value="'.$url_and.'action=thankyou&id='.$comicnum.'" />';
$buy_output .= '<input type="hidden" name="amount" value="'.$buy_print_amount.'" />';
$buy_output .= '<input type="hidden" name="item_number" value="'.$comicnum.'" />';
$buy_output .= '<input type="hidden" name="business" value="'.ceo_pluginfo('buy_comic_email').'" />';
$buy_output .= '<input type="image" src="'.ceo_pluginfo('plugin_url').'images/buynow_paypal.png" name="submit32" alt="'.__('Make payments with PayPal - it is fast, free and secure!','comiceasel').'" />';
$buy_output .= '</form>';
}
if ($buyprint_status == __('Sold','comiceasel')) {
$buy_output .= '<img src="'.ceo_pluginfo('plugin_url').'images/sold.png" alt="'.__('Sold','comiceasel').'" />';
} elseif ($buyprint_status == __('Out Of Stock','comiceasel')) {
$buy_output .= '<img src="'.ceo_pluginfo('plugin_url').'images/outofstock.png" alt="'.__('Out Of Stock','comiceasel').'" />';
} elseif ($buyprint_status == __('Not Available','comiceasel')) {
$buy_output .= '<img src="'.ceo_pluginfo('plugin_url').'images/notavailable.png" alt="'.__('Not Available','comiceasel').'" />';
}
$buy_output .= '</div>';
$buy_output .= '</td>';
}
// buy original
if (ceo_pluginfo('buy_comic_sell_original')) {
$buy_output .= '<td align="left" valign="top" style="width:50%;">';
$buy_output .= '<div class="buycomic-us-form" style="width:100%;">';
$buy_output .= '<h4 class="buycomic-title">Original</h4>';
$buy_output .= '$'.$buy_print_orig_amount.'<br />';
if ($buyorig_status == __('Available','comiceasel')) {
$buy_output .= '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
$buy_output .= '<input type="hidden" name="add" value="1" />';
$buy_output .= '<input type="hidden" name="cmd" value="_cart" />';
$buy_output .= '<input type="hidden" name="notify_url" value="'.home_url().'/?ceopaypalipn">';
$buy_output .= '<input type="hidden" name="item_name" value="'.__('Original','comiceasel').' - '.get_the_title($post->ID).' - '.$post->ID.'" />';
// Say a thank you and that transaction went through with an action
$url = ceo_pluginfo('buy_comic_url');
$url_and = (strpos($url,'?')) ? $url.'&' : $url.'?';
$buy_output .= '<input type="hidden" name="return" value="'.$url_and.'action=thankyou&id='.$comicnum.'" />';
$buy_output .= '<input type="hidden" name="amount" value="'.$buy_print_orig_amount.'" />';
$buy_output .= '<input type="hidden" name="item_number" value="'.$comicnum.'" />';
$buy_output .= '<input type="hidden" name="business" value="'.ceo_pluginfo('buy_comic_email').'" />';
$buy_output .= '<input type="image" src="'.ceo_pluginfo('plugin_url').'images/buynow_paypal.png" name="submit32" alt="'.__('Make payments with PayPal - it is fast, free and secure!','comiceasel').'" />';
$buy_output .= '</form>';
}
if ($buyorig_status == __('Sold','comiceasel')) {
$buy_output .= '<img src="'.ceo_pluginfo('plugin_url').'images/sold.png" alt="'.__('Sold','comiceasel').'" />';
} elseif ($buyorig_status == __('Out Of Stock','comiceasel')) {
$buy_output .= '<img src="'.ceo_pluginfo('plugin_url').'images/outofstock.png" alt="'.__('Out Of Stock','comiceasel').'" />';
} elseif ($buyorig_status == __('Not Available','comiceasel')) {
$buy_output .= '<img src="'.ceo_pluginfo('plugin_url').'images/notavailable.png" alt="'.__('Not Available','comiceasel').'" />';
}
$buy_output .= '</div>';
$buy_output .= '</td>';
}
$buy_output .= '</tr>';
$buy_output .= "</table>\r\n";
$buy_output .= '<div class="buy-thumbnail">';
$buy_output .= ceo_display_comic_thumbnail('large', $post);
$buy_output .= "</div>\r\n";
/* $last_info = get_option('ceo_paypal_receiver'); // Debug to see the last transaction, which is stored in this option
if (!empty($last_info)) $buy_output .= nl2br($last_info); */
} else {
$buy_output .= __('Invalid Comic ID.','comiceasel')."<br />\r\n";
}
ceo_unprotect();
}
return $buy_output;
}
Code file location:
comic-easel/comic-easel/functions/shortcodes.php
Comic Easel [comic-archive-dropdown] Shortcode
The Comic Easel plugin shortcode, ‘comic-archive-dropdown’, generates a dropdown menu of comic archives. This function extracts attributes like ‘unhide’, ‘exclude’, ‘showcount’, ‘jumptoarchive’, and ‘return’. It then calls the ‘ceo_comic_archive_jump_to_chapter’ function with these attributes, returning a dropdown menu.
Shortcode: [comic-archive-dropdown]
Parameters
Here is a list of all possible comic-archive-dropdown shortcode parameters and attributes:
unhide
– A boolean value to show or hide the archive dropdownexclude
– A string to exclude specific chapters from the dropdownshowcount
– A boolean value to display or hide the count of comics in each chapterjumptoarchive
– A boolean value to enable or disable the automatic redirection to the selected chapterreturn
– A boolean value to decide if the function should return the dropdown or display it directly
Examples and Usage
Basic example – A simple usage of the comic-archive-dropdown shortcode to display a dropdown menu of comic archive
[comic-archive-dropdown /]
Advanced examples
Use the shortcode to display a dropdown menu of comic archive, excluding specific comics, and showing the count of comics per archive. This example also enables the ‘jumptoarchive’ attribute which allows users to jump to the selected archive immediately upon selection.
[comic-archive-dropdown exclude="5,10" showcount="true" jumptoarchive="true" /]
Another advanced usage of the shortcode where it displays a dropdown menu of comic archive, including hidden comics, excluding specific comics, and not showing the count of comics per archive.
[comic-archive-dropdown unhide="true" exclude="3,7" showcount="false" /]
Finally, an example where the dropdown menu of comic archive is displayed with all comics included, the count of comics per archive shown, and the ‘return’ attribute set to false. This means the page will not return to the original state after selection.
[comic-archive-dropdown unhide="true" showcount="true" return="false" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [comic-archive-dropdown]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('comic-archive-dropdown', 'ceo_comic_archive_dropdown');
Shortcode PHP function:
function ceo_comic_archive_dropdown($atts, $content='') {
extract( shortcode_atts( array(
'unhide' => false,
'exclude' => '',
'showcount' => false,
'jumptoarchive' => false,
'return' => true
), $atts ) );
return ceo_comic_archive_jump_to_chapter($unhide, $exclude, $showcount, $jumptoarchive, $return);
}
Code file location:
comic-easel/comic-easel/functions/shortcodes.php
Comic Easel [randcomic] Shortcode
The Comic Easel Plugin shortcode ‘randcomic’ generates a random comic post. It extracts various attributes like character, size, slug, chapter, order, and date. It initiates a new WP_Query to fetch a comic post excluding the current one. If a post thumbnail exists, it displays it as a hyperlink to the comic post, else it shows a ‘No Thumbnail Found’ message.
Shortcode: [randcomic]
Parameters
Here is a list of all possible randcomic shortcode parameters and attributes:
character
– To specify the character involved in the comic.size
– Determines the size of the comic thumbnail.slug
– It’s a unique WordPress identifier for the comic.chapter
– Refers to a specific chapter of the comic.orderby
– Defines the order of the comics, default is random.month
– Filters comics according to the month of publication.day
– Filters comics based on the day of publication.year
– Filters comics based on the year of publication.
Examples and Usage
Basic example – Show a random comic thumbnail with the ‘randcomic’ shortcode.
[randcomic /]
Advanced examples
Display a random comic of a specific character in a specific chapter. The ‘character’ and ‘chapter’ attributes are used to filter the comics. The size of the thumbnail can also be specified.
[randcomic character="John Doe" chapter="Chapter 1" size="medium" /]
Display a random comic posted on a specific date. The ‘year’, ‘month’, and ‘day’ attributes are used to filter the comics. If the comic does not have a thumbnail, a message ‘No Thumbnail Found.’ will be displayed.
[randcomic year="2022" month="01" day="01" /]
Display a random comic by using the ‘slug’ attribute. The ‘orderby’ attribute is used to order the comics. In this example, the comics are ordered randomly.
[randcomic slug="comic-slug" orderby="rand" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [randcomic]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('randcomic', 'ceo_random_comic_shortcode'); // old
Shortcode PHP function:
function ceo_random_comic_shortcode($atts, $content = '') {
extract( shortcode_atts( array(
'character' => '',
'size' => 'thumbnail',
'slug' => '',
'chapter' => '',
'orderby' => 'rand',
'month' => '',
'day' => '',
'year' => ''
), $atts ) );
global $post;
$args = array(
'name' => $slug,
'orderby' => $orderby,
'showposts' => 1,
'post_type' => 'comic',
'chapters' => $chapter,
'characters' => $character,
'exclude' => $post->ID,
'year' => $year,
'month' => $month,
'day' => $day
);
ceo_protect();
$thumbnail_query = new WP_Query($args);
$output = '';
$archive_image = '';
if ($thumbnail_query->have_posts()) {
while ($thumbnail_query->have_posts()) : $thumbnail_query->the_post();
$the_permalink = get_permalink($post->ID);
$output = '<div class="rand-comic-wrap rand-comic-'.$post->ID.'">';
if ( has_post_thumbnail($post->ID) ) {
$output .= "<a href=\"".$the_permalink."\" rel=\"bookmark\" title=\"".get_the_title()."\">".get_the_post_thumbnail($post->ID, $size)."</a>\r\n";
} else {
$output .= __('No Thumbnail Found.','comiceasel');
}
$output .= "</div>\r\n";
endwhile;
}
ceo_unprotect();
return $output;
}
Code file location:
comic-easel/comic-easel/functions/shortcodes.php
Conclusion
Now that you’ve learned how to embed the Comic Easel Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply