5 replies [Last post]
sinclairL
sinclairL's picture
Offline
newbie
Last seen: 3 years 18 weeks ago
Timezone: GMT-7
Joined: 2011-06-17
Posts: 4
Points: 5

Good Day all.

Need a bit of help from you guys, I've been trying to get this answered for a couple of days now, hope someone is kind enough to help.

I'm working in comicpress (wordpress theme) and will have 3 comics in my site, one of them will be a graphic novel so I need to change the layout for that particular category to "graphic novel" , which is a preset in the theme. I have no knowledge of CSS but after reading some posts and tutorials I figure the best way to go would be to make a category template and call the layout, however I can't script CSS, heres the idea in OOP ...

make a file named "category-slug.php"

if category = "x" {
site layout = graphic novel layout.
}

my questions are:
Is this the best way to go for it? will it work?
how should I call the graphic novel layout? where can I find out its instance name (or whatever is used to call it).
If its only a couple of lines, could someone write it for me? or point me to a tutorial were I can learn how to do this without learning the whole language?

Thank you.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 9 hours 50 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9229
Points: 3235

The pages that contain the

The pages that contain the graphic novel simply link to the appropriate style sheet. If the comics all appear on the same page, wrap the section containing the graphic novel in a div with an id, e.g. <div id="gn">. Then fold the graphic novel styles into the main styles by cascading from #gn. I doubt it will be as simple as I've described it; WP themes are notoriously over-complicated in order that one size should fit all.

cheers,

gary

Unplanned code results in a tangled wad of brain-cramping confusion.

There are enough html & css demos and tutorials to be interesting. Please visit.

sinclairL
sinclairL's picture
Offline
newbie
Last seen: 3 years 18 weeks ago
Timezone: GMT-7
Joined: 2011-06-17
Posts: 4
Points: 5

yes from what I've seen so

yes from what I've seen so far, WordPress follows a loop that handle how the posts will be displayed by using a bunch of conditionals that load templates, the easiest way to resolve my problem would be to add :

  $post = $wp_query->post;
 
  if (in_category('1')) {
      include(TEMPLATEPATH.'/single1.php');
 
  } else {
      include(TEMPLATEPATH.'/single_default.php');
  }

(that was taken from a tutorial) My main problem is that I can't code a template. Seeing how the layout for graphic novel already exists, Id assume it would be easy to simply copy and paste the style sheet and add it as single1.php...but no, like you said its over-complicated with conditionals and an insane amount of templates linked to each other and there's only so much I can grasp from a language I don't fully understand.

If you or someone reading here knows were to copy the layout from 9or any other workaround) id appreciate it.
By the way I already tried the comicpress forums, I subscribed twice and never received the confirmation e-mail so no luck there Sad

thanks.

sinclairL
sinclairL's picture
Offline
newbie
Last seen: 3 years 18 weeks ago
Timezone: GMT-7
Joined: 2011-06-17
Posts: 4
Points: 5

advances...

I think I'm close to something...I found this on the functions.php

if ($comicpress_themeinfo['cp_theme_layout'] == 'gn') $comicpress_themeinfo['cp_theme_layout'] = 'lgn';

hope it help somehow.

Ill try to integrate it myself in the mean time.

sinclairL
sinclairL's picture
Offline
newbie
Last seen: 3 years 18 weeks ago
Timezone: GMT-7
Joined: 2011-06-17
Posts: 4
Points: 5

DID IT!

woot! I've done it. Id like to share how I did since I've looked all over the internet for it, perhaps someone will stumble upon this.

What I did was:

Open up funcitons.php and find out the name of the layout.
Copy it close, then open up single.php
After the get header function write"

$post = $wp_query->post;

if (in_category('5')) {
$comicpress_themeinfo['cp_theme_layout'] = 'lgn';

of course substitute 5 for the ID for your category and lgn for whichever layout you want for it

Save and close. Enjoy.

Thanx Gary, this is now solved.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 hours 48 min ago
London
Timezone: GMT+1
Joined: 2004-06-06
Posts: 15664
Points: 2802

Of course the simplest method

Of course the simplest method of utilising separate templates is to select them from the post screen template selection dropdown, a copied existing file with name changed to suit and at the top of the file you write:

<?php
/*
 * Template Name: the name that will display
 *
 * A custom page template description 'optional'.
 */

This is though a manual selection each time a post or page is created.

WP is actually quite flexible, there are many ways to achieve things if what you have works - and it looks ok - then that's fine. always check the WP codex as it's now quite a useful resource with plenty of examples to follow.

with what you show above do remember that theming in WP is hugely flexible and you can create any custom classes, functions, filters, action you care to in functions.php producing a unique approach in ones theme and the code example above is naturally particular to your theme.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me