mgsisk / webcomic

Comic publishing power for the web. Turn your WordPress-powered site into a comic publishing platform with Webcomic.
http://wordpress.org/plugins/webcomic
GNU General Public License v2.0
110 stars 29 forks source link

Shortcode for Individual Storyline Archive? #286

Closed glancereviver closed 6 years ago

glancereviver commented 7 years ago

Hi! I have another question, I hope this one is less complicated!

Everyone seems to really enjoy the thumbnail view on the archives template. However, some of the stories are hundreds of pages long, so to avoid ridiculous load times and scrolling forever, we'd like to have an indivisual archive page for each storyline.

So I suppose the solution would be either making some kind of edit to the archive template to tell it to show thumbnails from a specific storyline, or just a shortcode that could accomplish the same thing.

For example, I tried this shortcode from the wiki:

[webcomic_list_storylines collection="webcomic7" webcomics="true" webcomic_image="thumbnail"]

I tried to add term (storyline) ID to it like term="49" but that didn't do anything to it. Not sure if this functionality doesn't exist, or I'm just using the wrong shortcode.

I'd really appreciate any help with this, thank you!

glancereviver commented 7 years ago

I figured out how to use the archive pages to generate archives for single storylines! I would still like to be able to put it in a page with a template or shortcode, but the archives work for the moment.

glancereviver commented 7 years ago

I am sorry this problem/solution keeps changing!

Right now I have the archives all figured out, I can set the target to "archive" and it displays a paginated page of just that chapter, which is pretty close to what I wanted.

Problem now is, I would really like to show the links to storyline archives within a collection as cover thumbnails.

I have these settings: archive

However, it's still showing text links to storylines and not images.

eh-jogos commented 7 years ago

Hello!

The end result of what you are trying to achieve is similar to this ?

Or is it similar to this one?

Mihari commented 7 years ago

@vandalk

Very nice, I would be interested in learning what you did for both examples.

glancereviver commented 7 years ago

Thanks for your response!

What I'm looking for is not exactly like either of those, although both have part of what I need. The way you styled it is really cool too, I like the horizontal banner-style covers.

I found the archive link (like your first example) that displays posts in a storyline. So that part, I figured it out. But I need to link to each storyline in a collection from a page so that users can easily find them.

I can't get the webcomic archive page template to show storyline covers as thumbnail links to each storyline archive without also displaying all the thumbnails for every page contained in that storyline (like your example 2).

So I guess the easiest way would be to say that I want something like your second example, but without the pages' thumbnails loading underneath the storyline headers.

eh-jogos commented 7 years ago

@glancereviver Look at this one, I think now it's pretty much what you described!

What I'm doing is creating a page, and selecting a custom page-template to it, and selecting the collection I want to it through the standard drop down menus on wordpress page creation page.

Then on the custom page template php file I use the following code

$webcomic_arguments = array(
    'collection' => get_post_meta(get_the_ID(), 'webcomic_collection', true),
    'order' =>"DESC",
    'target' => "archive",
    'webcomic_order' => "ASC",
    'show_image' => "full",
    'show_description' => true
);

webcomic_list_storylines($webcomic_arguments);

That and a lot of css to style the output of webcomic_list_storylines. You can also find more about it on webcomics documentation

@Mihari Thanks! The second example I explained above to @glancereviver , but the diference is in the array of arguments I used! The exact array of arguments I used on my site is:

$webcomic_arguments = array(
    'collection' => get_post_meta(get_the_ID(), 'webcomic_collection', true),
    'webcomics' => true,
    'order' =>"DESC",
    'target' => "archive",
    'webcomic_order' => "ASC",
    'webcomic_image' => "thumbnail",
    'show_image' => "full",
    'show_description' => true
);

On the first example I sent I did it with custom queries. I can't exactly remember why, as I did this site almost two years ago, and at the time I was studying both php and wordpress, but I didn't get to work with it a lot after I finished this site, so I'm very rusty at it.

So for the storyline archive, as well as the character archive (note that in our site we don't use the character tag for characters in the story, we use them to specify who is the author of the page, as we are in 3 authors who used to rotate doing one page a week, continuing the story from where it left off) I modified the "storyline.php" and "character.php" to call a custom query inside a <ul> element as bellow

<ul class="webcomics">  
    <?php 
    $args = array(
        'posts_per_page' => -1,
        'post_type' => get_post_type(),
        'order' => "ASC",
        get_post_type()."_storyline" => get_query_var("term"),
    );

    $Storyline_query = new WP_Query( $args);

    if ( $Storyline_query->have_posts() ) { 
        while ( $Storyline_query->have_posts() ) { 
            $Storyline_query->the_post();
            get_template_part('webcomic/content',"thumbailList");
        }
    }
    wp_reset_postdata(); ?>
</ul>

The "template part" I'm calling inside the loop is very simple, it's just a <li> element with the page link:

<li>    
    <a href="<?php the_permalink(); ?>" rel="bookmark">
        <?php the_webcomic("thumbnail"); ?>
    </a>
</li>

Now the custom query for the character archive is a lot more complex as it grabs from multiple collections, but if you need it I'd have to stop and try to understand it again before sharing it so i can explain what it's doing, or if you wish I can send the file to you so you can try to read it and understand it. Though I didn't comment anything on it and I deeply regret it now as I don't remember what some stuff there is doing at all!

glancereviver commented 7 years ago

Thanks for your help. I used the above code, but still have the same results. It's only showing the text header, no image.

$webcomic_group = get_post_meta(get_the_ID(), 'inkblot_webcomic_group', true);
            $webcomic_arguments = array(
                    'collection' => get_post_meta(get_the_ID(), 'webcomic_collection', true),
                    'order' =>"ASC",
                'target' => "archive",
                    'webcomic_order' => "DESC",
                                'show_image' => "full",
                    'show_description' => true
);

            webcomic_list_storylines($webcomic_arguments);

And the results are still just a list like

new canvas

eh-jogos commented 7 years ago

At least it got rid of the individual webcomic links and it's only showing storyline titles, apparently!

The description for "show_image" on the documentation says it's "Size of the term image to use for term links" but I never noticed it's data type is a "boolean"

Also, after I posted I did some tests, and you don't need the "webcomic_order" as you don't want to display individual webcomic links! I let that slip in my other reply

So the correct code should be:

$webcomic_group = get_post_meta(get_the_ID(), 'inkblot_webcomic_group', true);

$webcomic_arguments = array(
    'collection' => get_post_meta(get_the_ID(), 'webcomic_collection', true),
    'order' =>"ASC",
    'target' => "archive",
    'show_image' => true,
    'show_description' => true
);

    webcomic_list_storylines($webcomic_arguments);

Maybe for some reason that line was evaluating as trueto me and as false to you?

Also what is $webcomic_group = get_post_meta(get_the_ID(), 'inkblot_webcomic_group', true); doing?

Lastly, are you sure you have set up a cover image on the properties of each storyline? It won't show any image if the storyline has no "cover", like this page !

EDIT: Oh, and by the way, if you're not going to use a description for each storyline, you can also get rid of the line 'show_description' => true or set it to false

glancereviver commented 7 years ago

I updated the code to account for the boolean, but there's still no change on how the archive is displayed.

I deleted the first line, I don't really know what it does, I had copy/pasted it from the webcomic template in case it was important, but I tried deleting it and it doesn't seem relevant. My code is now like this:

            $webcomic_arguments = array(
                    'collection' => get_post_meta(get_the_ID(), 'webcomic_collection', true),
                    'order' =>"ASC",
                    'target' => "archive",
                'show_image' => true,
                'show_description' => true,
            );

            webcomic_list_storylines($webcomic_arguments);

But the archive looks basically the same. Text headers as links, no images.

I definitely have covers set up, that's the first thing I thought of that might be the problem, so I double checked it.

On a good note, the description underneath works just fine, and I like that feature.

I'm trying to think of what it could be keeping it from displaying any image. Are there maybe some settings anywhere in Webcomic or Wordpress that might override this somehow?

glancereviver commented 7 years ago

Hey, I got it.

I checked all CSS and found

div.webcomic-term-image {
    display:none;
}

So that was the culprit, thanks for all of your help!

eh-jogos commented 7 years ago

Glad it's working!