virusvisal
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: “Faux text” within the editorThe wordpress version is 4.4.7
I did deactivate all plugins and the problem still persisted :cForum: Plugins
In reply to: [Comic Easel] Comic archive as image thumbnailsWho me? No, it was probably someone else O=.
I was looking if someone had made it and found this thread, so I did it myself and thought it would be nice to share.Forum: Plugins
In reply to: [Comic Easel] Comic archive as image thumbnailsAh! It might be obvious but just in case: the # on chapter=# will stand for the ID of the chapter you want to show just as in the normal shortcodes. It can be found on the chapter’s page on the dashboard.
Forum: Plugins
In reply to: [Comic Easel] Comic archive as image thumbnailsHi there!! I too have a very basic knowledge of php, but managed to customize Frumph’s code. I see you did get your thumbnail archive with a script but since this is the most recent post on the matter I thought it would be nice to share what I did.
The shortcode I modified works with the following shortcode:
[thumb-comic-archive chapter=#]You can leave out the chapter and it will display all comics. I just managed to make it work on those 2 modes.
I have a functions.php file on my child theme with the following code:
<?php /* Short Codes go Here */ add_shortcode('thumb-comic-archive', 'ceo_archive_list_thumb'); function ceo_archive_list_thumb( $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_thumb($order); break; case 0: default: if ($chapter) { $output = ceo_archive_list_single_thumb($chapter, $order, $thumbnail); } else { $output = ceo_archive_list_all_thumb($order, $thumbnail); } break; } wp_reset_postdata(); return $output; } // Case 0 function ceo_archive_list_single_thumb($chapter = 0, $order = 'ASC', $thumbnail = 0) { $output = ''; // get chapter from ID# $single_chapter = get_term_by('term_id', $chapter, 'chapters'); if (is_null($single_chapter)) { echo "Invalid Chapter Specified"; return; } $output .= '<div class="comic-archive-chapter-wrap">'; $args = array( 'numberposts' => -1, 'post_type' => 'comic', 'orderby' => 'post_date', 'order' => $order, 'post_status' => 'publish', 'chapters' => $single_chapter->slug ); $qposts = get_posts( $args ); $archive_count = 0; if ($thumbnail) { $output .= '<div class="comic-archive-thumbnail">'.get_the_post_thumbnail($qposts[0]->ID, 'thumbnail').'</div>'; } $output .= '<div class="comic-archive-list-wrap">'; $css_alt = false; foreach ($qposts as $qpost) { $archive_count++; if ($css_alt) { $alternate = ' comic-list-alt'; $css_alt = false; } else { $alternate = ''; $css_alt=true; } $output .= '<div class="comic-list comic-list-thumb comic-list-'.$archive_count.$alternate.'"><span class="comic-archive-title"><a href="'.get_permalink($qpost->ID).'" rel="bookmark" title="'.__('Permanent Link:','comiceasel').' '.$qpost->post_title.'">'.get_the_post_thumbnail( $qpost->ID, 'thumbnail' ).'</a></span></div>'; } $output .= '</div>'; $output .= '<div style="clear:both;"></div></div>'; return $output; } // Case 0 Else function ceo_archive_list_all_thumb($order = 'ASC', $thumbnail = 0) { $output = ''; $main_args = array( 'hide_empty' => true, 'order' => $order, 'orderby' => 'menu_order', 'hierarchical' => 1 ); $all_chapters = get_terms('chapters', $main_args); if (is_null($all_chapters)) { echo 'There are no chapters available.'; return; } $output = ''; foreach ($all_chapters as $chapter) { if ($chapter->count) { $output .= '<div class="comic-archive-chapter-wrap">'."\r\n"; $args = array( 'numberposts' => -1, 'post_type' => 'comic', 'orderby' => 'post_date', 'order' => $order, 'post_status' => 'publish', 'chapters' => $chapter->slug ); $qposts = get_posts( $args ); $archive_count = 0; if ($thumbnail) { $get_thumbnail = (strtoupper($order) == 'ASC') ? get_the_post_thumbnail(reset($qposts)->ID, 'thumbnail') : get_the_post_thumbnail(end($qposts)->ID, 'thumbnail'); $output .= '<div class="comic-archive-thumbnail">'.$get_thumbnail.'</div>'."\r\n"; } $output .= '<div class="comic-archive-list-wrap">'."\r\n"; $css_alt = false; foreach ($qposts as $qpost) { $archive_count++; if ($css_alt) { $alternate = ' comic-list-alt'; $css_alt = false; } else { $alternate = ''; $css_alt=true; } $output .= '<div class="comic-list comic-list-thumb comic-list-'.$archive_count.$alternate.'"><span class="comic-archive-title"><a href="'.get_permalink($qpost->ID).'" rel="bookmark" title="'.__('Permanent Link:','comiceasel').' '.$qpost->post_title.'">'.get_the_post_thumbnail( $qpost->ID, 'thumbnail' ).'</a></span></div>'."\r\n"; } $output .= '</div>'."\r\n"; $output .= '<div style="clear:both;"></div></div>'."\r\n"; } $qposts = null; } return $output; } // Case 4 function ceo_archive_list_by_chapter_thumb($order = 'ASC', $showtitle = false) { $output = ''; $archive_count = 0; $args = array( 'pad_counts' => 0, 'order' => $order, 'hide_empty' => 1, 'orderby' => 'menu_order' ); $chapters = get_terms('chapters', $args); if (is_array($chapters) && !is_wp_error($chapters)) { $output .= '<div class="comic-archive-list-4">'; foreach($chapters as $chapter) { $qcposts = null; if (!empty($chapter->menu_order)) { $child_args = array( 'numberposts' => 1, 'post_type' => 'comic', 'orderby' => 'post_date', 'order' => 'ASC', 'post_status' => 'publish', 'chapters' => $chapter->slug ); $qcposts = get_posts( $child_args ); $qcposts = reset($qcposts); if (has_post_thumbnail($qcposts->ID)) { $output .= '<div class="comic-archive-thumbnail"><a href="'.get_permalink($qcposts).'">'.get_the_post_thumbnail($qcposts->ID, 'thumbnail').'</a></div>'; } else $output .= __('No Thumbnail Found', 'comiceasel'); } } $output .= '<div class="clear"></div></div>'; return $output; } } ?>This will show a list of thumbs as links with no more info.
Again, this is just Frumph’s code a little bit messed with so it would show every comic page’s thumbnail, so credit goes to him for having such a great tool for comics. The functions names are changed so it doesn’t interfere with easel’s original code.
I hope this helps someone in the future =).