Community Forums › Forums › Archived Forums › Design Tips and Tricks › Creating a custom category template
- This topic has 2 replies, 2 voices, and was last updated 10 years, 2 months ago by
michaeloeser.
-
AuthorPosts
-
November 25, 2014 at 9:04 am #132755
michaeloeser
MemberHi everyone,
I haven´t worked with Genesis for a while and now I need to create a custom category template for a new Genesis child theme. In a former child theme (XHTML syntax) I used a file category-big-data.php (for the category "big-data" obviously) with this code:
<?php get_header(); ?> <?php genesis_before_content_sidebar_wrap(); ?> <div id="content-sidebar-wrap"> <?php genesis_before_content(); ?> <div id="content" class="hfeed"> <?php genesis_before_loop(); ?> <!-- Category sponsoring Logo or Banner --> <div align="left"><a href="http://applications.teradata.com/automotive/home/.ashx" target="_blank"><img src="http://www.automotiveit.eu/shared-assets/subnets/logo-terradata.jpg" /></a></div> <?php $i=1; if (have_posts()) : while (have_posts()) : the_post(); // the loop ?> <?php genesis_before_post(); ?> <div <?php post_class(); ?>> <?php genesis_before_post_title(); ?> <h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php genesis_after_post_title(); ?> <?php genesis_before_post_content(); ?> <div class="entry-content"> <?php if(genesis_get_option('content_archive') == 'full') : the_content(__('[Read more...]', 'genesis')); else : if(genesis_get_option('thumbnail')) genesis_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array('class' => 'alignleft post-image'))); the_excerpt(); endif; ?> </div><!-- end .entry-content --> <?php genesis_after_post_content(); ?> <?php if($i == 3 ) : ?> <!-- Banner 2 --> <?php // Include the category rectangle (or other) ad //include(CHILD_DIR.'/inc/plm-ad.php'); ?> <?php endif; ?><!-- end if Abfrage für Banner --> </div><!-- end .postclass --> <?php genesis_after_post(); ?> <?php $i++; endwhile; // end of one post ?> <?php genesis_after_endwhile(); ?> <?php else : // if no posts exist ?> <?php genesis_loop_else(); ?> <p><?php _e('Sorry, no posts matched your criteria.', 'genesis'); ?></p> <?php endif; // end loop ?> <?php genesis_after_loop(); ?> </div><!-- end #content --> <?php genesis_after_content(); ?> </div><!-- end #content-sidebar-wrap --> <?php genesis_after_content_sidebar_wrap(); ?> <?php get_footer(); ?>
Now I need to use a similar category template with the latest Genesis version and a HTML 5 child theme. Where do I get the code that is used to output a category archive? Or in other words what´s the best way to create custom category archive templates (I might need a few of them).
Thanks
MichaelNovember 25, 2014 at 11:23 am #132768David Chu
ParticipantMichael,
Interesting question. I make loads of types of templates, but I haven't had the need for a category template yet. I may have handled that type of thing with hooks and filters. 🙂So you have plenty of Genesis code, but want the HTML5 version. Interesting!
Apart from converting ID's to classes and manual stuff like that, I wonder if this might give you a nice tidy base for that.
Dave
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
November 26, 2014 at 5:00 am #132851michaeloeser
MemberThanks David. I guess that already helps me.
Cheers
Michael -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.