Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End (wordpress) Comiceasel – How to override default post?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41327
    Spearfrost
    Member

    Hey guys,

    On an off note first (I am really liking the new look of the site. Very posh.) ^^

    Now on to the gritty stuff. I am trying to figure out how to override the plugin, ‘comic easel’ post which uses the default single.php and implement my own simple restructure to it. I am not well versed in php as yet and I am learning. Learning ALOT since I started messing around with wordpress. I know the answer is right in front of me… but for a blind noob, I am MISSING it.

    global $post;
    if ( post_password_required() ) {
    return __(‘This information is password protected.’,’comiceasel’);
    }
    $output = ”;
    if (ceo_the_above_html()) $output .= html_entity_decode(ceo_the_above_html()).”rn”;
    $post_image_id = get_post_thumbnail_id($post->ID);
    if ($post_image_id) {
    $thumbnail = wp_get_attachment_image_src( $post_image_id, $size, false);
    if (is_array($thumbnail)) {
    $thumbnail = reset($thumbnail);
    $hovertext = ceo_the_hovertext();
    if (ceo_pluginfo(‘navigate_only_chapters’)) {
    $next_comic = ceo_get_next_comic_in_chapter_permalink();
    } else {
    $next_comic = ceo_get_next_comic_permalink();
    }
    if (ceo_pluginfo(‘click_comic_next’) && !empty($next_comic)) {
    $output .= ‘‘;
    }
    $output .= ‘'.$hovertext.'‘;
    if (ceo_pluginfo(‘click_comic_next’) && !empty($next_comic)) {
    $output .= ‘
    ‘;
    }
    }
    }
    if (ceo_the_below_html()) $output .= html_entity_decode(ceo_the_below_html()).”rn”;
    $comic_galleries = get_post_meta( $post->ID, ‘comic-gallery’, true );
    if (!empty($comic_galleries)) {
    $columns = get_post_meta( $post->ID, ‘comic-gallery-columns’, true );
    if (empty($columns)) $columns = 5;
    $args = array(
    ‘id’ => $post->ID,
    ‘columns’ => $columns,
    ‘exclude’ => $post_image_id
    );
    $output .= gallery_shortcode($args);
    }
    if ($output) {
    return apply_filters(‘ceo_comics_display_comic’, $output);
    } else
    return __(‘No HTML, Gallery or featured image Found.’, ‘comiceasel’);
    }

    function ceo_the_hovertext($override_post = null) {
    global $post;
    $post_to_use = !is_null($override_post) ? $override_post : $post;
    $hovertext = esc_attr( get_post_meta( $post_to_use->ID, ‘comic-hovertext’, true ) );
    if (empty($hovertext)) $hovertext = esc_attr( get_post_meta($post_to_use->ID, ‘hovertext’, true) ); // check if using old hovertext
    return (empty($hovertext)) ? get_the_title($post_to_use->ID) : $hovertext;
    }

    function ceo_the_above_html($override_post = null) {
    global $post;
    $post_to_use = !is_null($override_post) ? $override_post : $post;
    $html_to_use = get_post_meta( $post_to_use->ID, ‘comic-html-above’, true);
    return $html_to_use;
    }

    function ceo_the_below_html($override_post = null) {
    global $post;
    $post_to_use = !is_null($override_post) ? $override_post : $post;
    $html_to_use = get_post_meta( $post_to_use->ID, ‘comic-html-below’, true);
    return $html_to_use;
    }

    // We use this type of query so that $post is set, it’s already set with is_single – but needs to be set on the home page
    function ceo_display_comic_area() {
    global $wp_query, $post;
    if (is_single()) {
    ceo_display_comic_wrapper();
    } else {
    if ((is_home() || is_front_page()) && !is_paged() && !ceo_pluginfo(‘disable_comic_on_home_page’)) {
    ceo_Protect();
    $comic_args = array(
    ‘showposts’ => 1,
    ‘posts_per_page’ => 1,
    ‘post_type’ => ‘comic’
    );
    $wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query($comic_args);
    while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
    ceo_display_comic_wrapper();
    break;
    endwhile;
    ceo_UnProtect();
    }
    }
    }

    // Do the thumbnail display functions here.
    function ceo_display_comic_thumbnail($thumbnail_size = ‘thumbnail’, $override_post = null) {
    global $post;
    $thumbnail = $output = ”;
    $post_to_use = !empty($override_post) ? $override_post : $post;

    if ( has_post_thumbnail($post_to_use->ID) ) {
    $output = ‘ID).'” rel=”bookmark” title=”‘.get_the_title().'”>’.get_the_post_thumbnail($post_to_use->ID, $thumbnail_size).’‘.”rn”;
    } else {
    // $output = “No Thumbnail Found.”;
    }
    return apply_filters(‘easel_display_comic_thumbnail’, $output);
    }

    Now 2 questions:

    1) Should I create an individual php file? OR
    2) Can I just edit this code and implement my own custom post style?

    #117306
    Spearfrost
    Member

    This is my custom post structure:

    /*
    Template Name: Comic Post
    /*
    ?>




    Sorry, no posts matched your criteria.




Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.