Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här skapar du kategorimallar i WordPress (4 metoder)

Att skapa unika mallar för kategorisidor i WordPress är ett bra sätt att organisera innehåll och förbättra användarupplevelsen. Detta är särskilt användbart om du har olika inläggskategorier som vi gör på WPBeginner.

Med anpassade kategorimallar kan du skräddarsy hur innehållet ska visas för varje kategori.

Du kan lyfta fram specifika inlägg, använda olika layouter eller lägga till unika element som passar innehållet i varje kategori. Det gör det lättare för besökarna att hitta det de letar efter och håller dem engagerade längre.

I den här artikeln visar vi dig steg för steg hur du skapar kategorimallar i WordPress.

Creating category templates in WordPress

Vad är kategorimallar och varför ska man skapa dem i WordPress?

På WordPress-webbplatser är det vanligt att man använder olika mallar för kategorier, taggar, anpassade inläggstyper och taxonomier.

Och när det gäller kategorier genererar WordPress individuella sidor för dem alla. Du kan se dem genom att besöka en URL som t.ex:

https://example.com/category/news/

De flesta populära WordPress-teman har nu inbyggda mallar för att visa upp kategorisidor på ett vackert sätt. Dessa mallar framhäver kategorititeln och visar kategoribeskrivningen under den.

Category page example

Vissa themes kanske dock inte hanterar detta så snyggt, eller ej, eller så kanske du vill customize dina category pages.

Genom att skapa templates för kategorier kan du add to utvalda funktioner på pages i kategorierna.

Du kan till exempel låta användare prenumerera på kategorier, visa kategoribeskrivningar, välja en annan layout för varje kategori och lägga till kategoribilder.

Förståelse av WordPress-mallhierarkin för kategorisidor

WordPress har ett kraftfullt templatesystem som gör att du kan skapa olika templates för olika sections på din website.

Vid displayed av en page letar WordPress efter en template i en fördefinierad hierarkisk order.

För att visa en kategorisida letar den efter mallar i följande ordning: category-slug.phpcategory-id . phpcategory.phparchive. phpindex . php.

Först kommer WordPress att leta efter en mall som är specifik för just den kategorin med hjälp av kategorins slug. Till exempel kommer mallen category-design.php att användas för att visa kategorin ”Design”.

Om den inte hittar en kategori-slug-mall kommer WordPress att leta efter en mall med ett kategori-ID, som category-6.php. Efter det letar den efter den generiska kategorimallen, som vanligtvis är category.php.

Om det inte finns någon generisk kategorimall kommer WordPress att leta efter en generisk arkivmall, t.ex. archive .php. Slutligen kommer mallen index.php att användas för att visa kategorin .

Här är vår guide till WordPress mall-hierarkier.

WordPress category archive

Med detta i åtanke kommer vi att dela med oss av stegen för hur du skapar kategorimallar i WordPress. Du kan använda snabblänkarna nedan för att hoppa till den metod du föredrar:

Är du redo? Låt oss komma igång.

Metod 1: Skapa en kategorimall med hjälp av fullständig webbplatsredigering

Det enklaste sättet att skapa en kategorimall är att använda verktyget Full Site Editing (FSE). Med den här metoden behöver du inte installera några plugins. Observera dock att FSE-funktionaliteten endast är tillgänglig för WordPress-blockteman.

För denna handledning använder vi temat Twenty Twenty-Three.

Så nu ska vi installera och aktivera det på din webbplats. Om du behöver hjälp kan du läsa vår guide om hur du installerar ett WordPress-tema.

Efter aktivering måste du navigera till Utseende ” Redaktör.

För att skapa en kategorimall klickar vi på menyalternativet ”Mallar” och sedan på knappen ”Lägg till ny mall”.

Add New Template button in FSE

På nästa skärm ser du olika alternativ för att skapa mallar.

Eftersom vi ska skapa en kategorimall väljer vi ”Kategoriarkiv”. Klicka bara på den, så ser du ett nytt snabbfönster.

Category Archives option in FSE

Här måste du bestämma om du vill använda den anpassade mallen för alla kategorier eller för en viss kategori.

I den här handledningen väljer vi ”Kategori”.

Choosing a specific category item

Nästa steg är att välja en befintlig kategori från din WordPress-webbplats.

Du behöver bara klicka på den kategori du vill ha från listan.

Category list

När du har gjort det kommer du att omdirigeras till att välja ett mönster för din nya kategorimall.

Klicka bara på den så öppnas blockredigeraren.

Editing category template in FSE

Härifrån kan du anpassa din kategorimall. När du är nöjd med hur det ser ut klickar du bara på ”Spara” för att göra dina ändringar live.

Metod 2: Skapa en kategorimall med hjälp av Thrive Theme Builder

Om du vill ha fler anpassningsmöjligheter är den här metoden något för dig.

Thrive Theme Builder är en del av varumärket Thrive Themes. Det är ett av de bästa verktygen för att skapa anpassade mallar för dina WordPress-kategorier.

Thrive Theme Builder homepage

För att använda det här verktyget måste du först skapa ett Thrive-konto. Gå bara till webbplatsen och klicka på knappen ”Get Thrive Suite”.

När du har köpt verktyget kan du gå vidare och ladda ner Thrive Product Manager. Alla Thrive-produkter kommer att finnas tillgängliga på dess instrumentpanel.

Downloading Thrive Product Manager

Sedan kan du gå tillbaka till ditt WordPress-adminområde och navigera till Plugins ” Lägg till nytt plugin. Här kommer du att ladda upp Thrive Product Manager-pluginets .zip-fil.

Om du behöver hjälp kan du läsa vår guide om hur du installerar ett WordPress-plugin.

Efter det vill du gå över till ”Produkthanterare”. Härifrån kan du bläddra ner på sidan för att hitta Thrive Theme Builder.

Markera rutan bredvid ”Installera tema” och klicka sedan på knappen ”Installera vald produkt”.

Installing Thrive Theme Builder

När produkthanteraren har slutfört installationen klickar du på ”Aktivera vald produkt”. Sedan kan du klicka på ”Gå till Theme Builder Dashboard” för att börja skapa en kategorimall.

Det första du behöver göra i byggaren är att välja ett tema. Håll bara muspekaren över ett tema och klicka på ”Välj” för att använda det.

För denna handledning använder vi ”Shapeshift”.

Choose Shapeshift theme

Du kommer då att omdirigeras till temabyggaren.

Härifrån går vi till menyn ”Mallar”. Sedan kan du klicka på knappen ”Lägg till ny”.

Adding new template in Thrive Theme Builder

Då öppnas ett popup-fönster.

Härifrån skapar du en ny listmall. Du kan börja med att ge mallen ett namn, till exempel ”Kategorimall”.

I fältet ”Enkel eller lista?” kan du sedan välja ”Lista”. Detta gör att du kan välja ”Arkiv” respektive ”Kategorier” i följande fält.

Creating new list in Thrive Theme Builder

Efter det väljer vi ”Alla kategorier” i fältet ”Definierad för”. Sedan kan du klicka på ”Välj mall” för att snabbt skapa en kategorimall.

Du måste välja en mall i det nya popup-fönstret. Klicka bara för att markera den och klicka sedan på knappen ”Skapa mall” när den visas.

Choosing a template for the new list

På nästa skärm ser du att du har skapat den nya kategorilistan.

Håll bara muspekaren över den och klicka på knappen ”Redigera” för att börja anpassa den.

Editing template list

Då öppnas byggprogrammet i en ny flik.

Härifrån kan du anpassa kategorimallen så att den matchar din vision. När du är klar kan du klicka på knappen ”Spara arbete” i det nedre vänstra hörnet.

Thrive Theme Builder's template builder

Metod 3: Skapa en kategorimall med hjälp av Beaver Themer

En annan nybörjarvänlig lösning är Beaver Themer, som låter dig skapa layouter för ditt tema. Du kan välja de enskilda kategorierna där du vill använda mallen och sedan redigera dem med hjälp av ett dra-och-släpp-verktyg.

Först måste du installera och aktivera Beaver Builder. Om du behöver hjälp kan du läsa vår guide om hur du installerar en WordPress-webbplats.

När du aktiverar den måste du verifiera din licensnyckel.

Gå bara till Inställningar ” Beaver Builder ” Licens . Sedan anger du din licensnyckel i textrutan och klickar på ”Spara licensnyckel”.

License key field in Beaver Builder

Du hittar nyckeln i ditt Beaver Builder-konto.

När du har gjort det ska du navigera till Beaver Builder ” Themer Layouts ” Lägg till ny.

Add new category template

Därefter måste du ge den en titel.

Sedan väljer du bara din kategori under alternativet ”Plats”.

Edit Beaver Themer layout

Du kan sedan använda Beaver Builders dra-och-släpp-redigerare för att anpassa din kategorilayoutsida efter eget tycke och smak.

Beaver Themer tillhandahåller massor av moduler som du kan använda och flytta runt för att designa din kategori layout page.

Using Beaver Builder to design your category template

När du är klar klickar du bara på knappen ”Done” och väljer sedan ”Publicera” för att tillämpa din template för kategorin.

Nu kan du besöka din WordPress website och se templates för kategorier i action.

A category template made with Beaver Builder

Metod 4: Skapa en kategorimall för ditt tema i WordPress

Innan vi börjar, låt oss först ta en titt på en typisk category.php-mall:

<?php
/**
* A Simple Category Template
*/

get_header(); ?> 

<section id="primary" class="site-content">
<div id="content" role="main">

<?php
// Check if there are any posts to display
if ( have_posts() ) : ?>

<header class="archive-header">
<h1 class="archive-title">Category: <?php single_cat_title( '', false ); ?></h1>

<?php
// Display optional category description
 if ( category_description() ) : ?>
<div class="archive-meta"><?php echo category_description(); ?></div>
<?php endif; ?>
</header>

<?php

// The Loop
while ( have_posts() ) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>

<div class="entry">
<?php the_content(); ?>

 <p class="postmetadata"><?php
  comments_popup_link( 'No comments yet', '1 comment', '% comments', 'comments-link', 'Comments closed');
?></p>
</div>

<?php endwhile; 

else: ?>
<p>Sorry, no posts matched your criteria.</p>

<?php endif; ?>
</div>
</section>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Låt oss nu anta att du har en kategori som heter ”Design” med kategorisloggan ”design” och att du vill visa den här kategorin på ett annat sätt än andra.

För att göra det måste du skapa en template för viss kategori. Gå till Appearance ” Theme Editor.

Från listan över theme-filer till höger klickar du på category.php.Om du ej har en category.php-fil där, leta då efter archive.php.

Theme category file editor

Om du inte kan hitta någon av dessa templates är det stor chans att du använder ett WordPress Theme Framework och denna tutorial kanske inte är användbar för you. Vi föreslår att du hänvisar till det specifika ramverk som du använder.

Om du hittar filerna ovan, kopiera då allt innehåll i category.php och klistra in det i en textredigerare som gillar Notepad. Save denna fil som category-design.php.

Du måste sedan ansluta till din WordPress-hosting med en FTP-klient och sedan gå till /wp-content/themes/ditt-aktuella-tema/ och ladda upp din category-design.php-fil till din temakatalog .

Nu kommer alla ändringar du gör i den här mallen bara att visas på arkivsidan för just den här kategorin.

Med den här tekniken kan du skapa mallar för så många kategorier som du vill. Använd helt enkelt category-{category-slug}.php som filnamn . Du kan hitta kategorisloggar genom att besöka kategorisektionen i WordPress adminområde.

Nedan visas ett exempel på en category-slug.php-mall. Observera att vi har använt samma mall som category.php med några få ändringar .

Eftersom vi redan vet vilken kategori den ska användas för kan vi lägga till titel, beskrivning eller andra detaljer manuellt. Lägg också märke till att vi har använt <?php the_excerpt(); ?> i stället för <?php the_content(); ?>.

<?php
/**
* A Simple Category Template
*/

get_header(); ?> 

<section id="primary" class="site-content">
<div id="content" role="main">
<?php
// Check if there are any posts to display
if ( have_posts() ) : ?>

<header class="archive-header">
<?php
// Since this template will only be used for Design category
// we can add category title and description manually.
// or even add images or change the layout
?>

<h1 class="archive-title">Design Articles</h1>
<div class="archive-meta">
Articles and tutorials about design and the web.
</div>
</header>

<?php

// The Loop
while ( have_posts() ) : the_post();
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>

<div class="entry">
<?php the_excerpt(); ?>

 <p class="postmetadata"><?php
  comments_popup_link( 'No comments yet', '1 comment', '% comments', 'comments-link', 'Comments closed');
?></p>
</div>

<?php endwhile; // End Loop

else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</div>
</section>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Om du inte vill använda mallen category-slug kan du använda mallen category-id för att skapa en mall för ett specifikt kategori-ID. Så här hittar du ett kategori-ID i WordPress.

Använda villkorliga taggar för en kategori

När du skapar templates för ditt theme måste du avgöra om du verkligen behöver en separat template för att göra det du vill göra.

I vissa fall är de ändringar du vill göra inte alltför komplicerade och kan uppnås med hjälp av villkorliga taggar i en generisk mall , som category.php eller till och med archive. php.

WordPress har support för många villkorsstyrda taggar som temaförfattare kan använda i sina templates.

Ett exempel på en villkorsstyrd tagg är is_category(). Med hjälp av denna villkorsstyrda tagg kan du ändra dina templates så att de visar olika utdata om villkoret matchas.

Låt oss till exempel anta att du har en kategori för utvalda inlägg som heter ”Featured”.

Nu vill du visa lite extra information på kategorins arkivsida för just den här kategorin. För att göra det lägger du till den här koden i filen category.php direkt efter <?php if ( have_posts() ) : ?>.

<header class="archive-header">

<?php if(is_category( 'Featured' )) : ?>
	<h1 class="archive-title">Featured Articles:</h1>
<?php  else: ?>
	<h1 class="archive-title">Category Archive: <?php single_cat_title(); ?> </h1>
<?php endif; ?>

</header>

Bonustips: Bygga en medlemssajt för att begränsa innehåll baserat på kategorier

En medlemssajt är en webbplats där endast medlemmar kan se särskilt innehåll, produkter eller tjänster.

Medlemmar betalar vanligtvis en avgift, som kan vara månadsvis, årlig eller något annat, för att få tillgång till premiumresurser. Det kan vara saker som kurser, artiklar, videor eller andra värdefulla resurser som icke-medlemmar inte kan se.

På alla sätt är målet med en medlemskapswebbplats att göra en stadig inkomst samtidigt som du ger din publik bra, exklusivt innehåll.

Nu kan du använda funktionen ”Regler” i MemberPress för att hantera vilket innehåll som är tillgängligt för olika medlemsplaner. Du kan välja olika villkor och länka dem till medlemsplaner, inklusive att begränsa innehåll efter kategorier.

Restricting categories in MemberPress

Mer information finns i vår guide om hur du skapar en medlemssajt så att du kan begränsa innehållet baserat på kategorier.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du skapar kategorimallar i WordPress. Du kanske också vill läsa våra guider om hur du ändrar prefixet för kategoribasen och hur du bara visar överordnad kategori i WordPress inläggsslinga.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

58 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Gwyneth Llewelyn says

    I just wanted to thank you — not only for the clarity of the explanations, but, most importantly, for restricting your code to the essential, while keeping all typical WordPress conventions (in terms of styling) as they were originally coded (even if they have, today, a ’retro’ style of coding!).

    This simplifies, for beginners and forgetful experienced programmers alike, to fully integrate a category page on a theme that doesn’t support them; because even though every theme does it slightly differently, there is enough common ground for a simple template to do its job while delegating more complex functionalities to theme-specific functions. That is, at least, the case with well-written themes, of course.

    Thanks again!

  3. Muhammad Zeeshan says

    I want to create the same custom page for all categories but I don’t want to create it one by one. If I add a new category in the future, I want the same template for the new category as for the old one. How can I get this?

    • Alexandro Giles says

      You only need to create 1 category.php template, this category template will be used in any category archive that you create.

  4. Daniel says

    Hi – Its a very helpful tutorial but I am trying to show a specific category and its sub categories on a page – How do i do that ?

  5. Barbara says

    I’m putting my question here because it’s the closest topic to what I am looking for. My church is going to put out a newsletter using Constant Contact. Our current newsletter has both short items and longer articles. I want to use short excerpts of the longer articles in the newsletter with a link to the article online. To that end, I have created a category-newsletter and using a plugin Unique Headers have changed the header image. I want now to suppress the H1 in the header, but since the header is called from the post page, the only way I can think of to obtain the result that I want is to do a custom page/post in which I don’t call header.php but include the contents of header.php in my custom post page. I might even want to do a custom footer.

    How do I do that without causing an error?

  6. Steven Denger says

    This is a knowledgable tutorial for making templates – if you are an advanced user of code. This is what I see too much here- an explanation for the advanced users or developers but is of little to no value to beginners. I thought that this was WP BEGINNER – this is hardly a beginners tutorial and was of no help to me what-so-ever.

  7. Daniel says

    Hello, great tutorial. I really want to add a limit of 5 posts per page and have page numbering. Can someone help me with the code?

  8. Chris Smith says

    Thank you so much for writing this article – I was trying so hard to find where the categories were stored for my personal blog site. I had been through every php I could find and searched relentlessly for categories in my FTP/ control panel. Although the advice given here basically said it couldn’t help and i wouldn’t find it useful, it did encourage me to look at the content.php which was in the ’framework’ directory of the theme. If anyone else is using the free version of the plum theme and wants to know how to do this in ftp, I hope this comment is useful!

  9. Richard Lowe says

    My theme came without a template for categories, tags, etc. So this article is perfect since I want them.

    Question: Would it be best to do this in a child theme so custom changes are not lost if and when the theme is updated?

  10. Borislav says

    For Custom Single Post page templates by category one could make a separated folder called ”single” and then put inside all single templates like single-category-slug.php. + the general single.php. There was also necessary to add some code in functions.php. Can you do the same technique for Category page templates, like put all category-slug.php + the general category.php in a map called ”category” ? I wonder that just to have a better file oragization istead of having all category-slug.php among all other theme php files like header.php footer.php index.php etc.

  11. rami mike says

    Thanks… that’s very useful. What if i want an archive page that display all the posts from 3 of my 5 categories….
    How can i do that ?

  12. Mark says

    Nice tutorial, I really appreciate the huge investment in wordpress tutorial and also in OptinMonster. But I will like to point out something in the tutorial: In the category template, you forget to echo the single_cat_title( ”, false );

    It should be:

    Category:

    Thanks

  13. Dan says

    When I use this template, I get the max set number of posts in the Dashboard, which is 10 posts only. When I select a category I want all of the posts for that category, not only the most recent 10. I tried adding query_posts(’posts_per_page=50’); at the beginning of the Loop, but when I do that then posts from a different category are appearing in my selection. Any ideas?

  14. Dnil says

    Hi, I have category.php file on my theme. But whenever I view it, it shows only the title and a brief summary of the post. I want to have image of the post instead of text appear below the blog title. Please help me sir. I can’t find a better solution. I’m a newbie at wordpress :( Thank you

  15. Dnil says

    Hi,

    I’m getting real problem on how can I add ”Image” in the category page instead of ”text”? :( Please is anyone can help me here?

    Here’s my category.php


    Thanks in advance. Please email me on how to fix this stuff.

  16. SevenT says

    Thank you for this helpful post. But when i try a first one code. It make error.
    Parse error: syntax error, unexpected ’<' in \category.php on line 22

    And the second one is same error on line 31

    What happen? I have checked it.

  17. Lisa says

    I am using Divi 2.1.4. I do not see any archive or category php. Can I use the index.php as the base and modify from there for a custom category page?

  18. JAspen says

    How would I have all my category page templates display on one page? I have 3 different category templates and look great on each single category page, but need them to display all together on one page.

  19. Bruce Bates says

    I solved my problem with your example code. You didn’t close the while loop on line 29 ?>

    29 while ( have_posts() ) : the_post();

  20. Bruce Bates says

    I am trying to create a theme (first time) and I am stuck on the category template. Have things changed as of wordpress 3.9? I literally copied and pasted the code you have here (removing the line numbers), saved the file, and tested it out and I get a fully blank page. Not even an opening html tag is happening when viewing outputted source.

  21. Deepa Govind says

    Hi,

    I am developing a child theme, and want to show a specific image alongside the category description — @ Category Archives page.

    ie, If category = Poetry, SHOW + description + post list
    if category = cooking, SHOW + description + post list
    if category = tutrial, SHOW + description + post list

    I know that we can put the IF-Condition in the category.php’s >> Archive header

    But, my list is pretty long — almost 20 categories
    and I donot want to clutter the actual category.php file

    Is it possible to write a custom function (in myfunc.php)
    and make a call at the category.php??

    Thank you

    • Deepa Govind says

      This is wierd, some of my text in the comment is missing
      so here it is again

      ie, If category = Poetry, SHOW QUILL IMAGE+ description + post list
      if category = cooking, SHOW CHEF IMAGE+ description + post list
      if category = tutrial, SHOW TEACHER IMAGE+ description + post list

  22. Lars says

    Hey! I have trouble with the theme I am developing. I want to show only one category pr. page, but when all posts for all categories shows up on all the pages. How can I show just one category pr. page without having to make a specific page for each page specifying the name of the category?

  23. Muhammed Ashique Kuthini says

    Can i get a function like showposts in this loop ? I am designer and recently came with development. I need to show the most recent post of the selected category in a different style.

  24. Cath says

    This seems straightforward but I’m having problems. I’m creating a child theme from a parent theme. The parent theme has an archive.php file only. In my child folder I want the archive.php for my Archives widget and for my Category widget, I want a category.php file. I’ve copied the archive.php code into a blank php file and saved it as category.php. The archive.php still defaults for both. Am I missing something? Thank you.

    • WPBeginner Support says

      Nope you are not missing anything. category.php should take over when ever a user is browsing a category page. This could happen for a number of reasons. For example WordPress may not be able to identify category.php file. Can you open category.php file in Appearance » Editor. Double check that you have not accidentally saved category.php as category.php.txt. Also check out our guide on creating child themes to make sure that you have created a child theme correctly.

      Administratör

      • Cath says

        Hi. I am able to open category.php with the Appearance>Editor. Does the category.php file need to be added somewhere? Thank you.

        • Cath says

          Hi. I am able to open category.php with the Appearance>Editor. The file is saved in my child theme with the rest of my files that are working on my site. Do I need to add it to the functions.php file in order for WordPress to use category.php instead of archive.php?

  25. Lex says

    Thanks for your great article. Very helpful.

    I have a custom post type – ”video”, and a custom taxonomy – ”video_categories” What would be the best way display them? I need a ”home” for all videos, and a page that lists videos from a category.

    archive-videos.php – ”home” listing page for all videos of all categories
    taxonomy-video_categories.php – a category listing page

    This is what I am thinking about. I feel there should be a better way. At the moment these two files have exactly the same code which is duplication.

    Thanks in advance for sharing your experience

  26. Amit Kumar says

    I liked the Idea of creating different designs for each category page. Can you please tell me how can I achieve a particular design for post under one specific category?

    For eg. All the post under category ”Design” will have a particular design format and background etc.

    I would be glad to have any link which can provide any hint related to this.

  27. Mark Roth says

    I’ve been wanting to do this for quite a while. It’s not that I don’t know how to do it, it’s that I keep forgetting…and being distracted by more important projects. Your post is a great reminder…and will be a handy reference point. I’ve added it to my bookmarks. Thanks!

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.