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

Hur man visar excerpt av post i WordPress Themes

Vill du lära dig hur du visar excerpt av post i ditt WordPress theme?

Genom att visa excerpt av post istället för hela artikeln på din blogg kan du hjälpa visitorerna att snabbt hitta intressant content och minska hämtartiden på din site.

I den här artikeln visar vi hur du enkelt kan add to post excerpts till ditt WordPress theme.

How to display post excerpts in WordPress themes

Varför visa excerpt av post i WordPress?

Som standard visar WordPress hela posts på homepage, blogginlägg och archive pages på hela din website. Detta är dock inte den bästa upplevelsen för användare som snabbt vill browsa genom de olika posterna och hitta den de vill läsa först.

Det kan också innebära att man måste rulla mycket, vilket är ett stort problem för användare av smartphones och surfplattor.

När du publicerar fler inlägg kan WordPress också dela upp dina bloggar på flera pages med hjälp av sidonumrering. När dina äldre inlägg flyttas till andra pages, får de ofta mycket färre views och mindre engagement.

Av denna anledning visar många blogginnehavare excerpt av post på sina archive- och blogginläggs pages istället. Eftersom bara en del av varje artikel hämtar kan detta öka din WordPress hastighet och prestanda.

An example of post excerpts in a WordPress theme

WordPress har built-in support för excerpt av inlägg, men ej alla teman använder sig av denna funktion.

Med detta sagt, låt oss visa dig hur du visar excerpt av post i alla WordPress teman.

Så här kontrollerar du om ditt WordPress Theme stöder excerpt av post

De flesta populära themes i WordPress har en inställning som allow you att visa excerpt av post istället för hela inlägget.

För att se om ditt tema stöder excerpt av post, besök sidan Appearance ” Customize i WordPress dashpanelen.

Platsen för dessa inställningar varierar beroende på ditt WordPress theme, men you need to look for any settings labeled ’Blogg’.

Adding post excerpts to a WordPress theme using the Customizer

Om du till exempel använder temat Astra WordPress måste du selecta ”Blog” och sedan clicka på ”Blog/Archive”.

Du kan sedan rulla ner till sektionen ”Post Elements” och förstora tabben ”Excerpt”. När du har gjort det väljer du alternativet ”Excerpt”.

Adding post excerpts to your WordPress website

Om ditt tema har ett alternativ för ”Theme Settings” eller ”Post General Settings” kan du kanske också aktivera excerpt av post i dessa sections.

När du har gjort det klickar du helt enkelt på knappen ”Publicera”. Om du nu besöker bloggen, archive eller homepage bör du se en lista med bloggutdrag snarare än hela posts.

Om ditt theme inte har built-in support för post excerpts, då måste you add to det. Använd bara snabblänkarna under för att hoppa till den metod du vill använda:

Metod 1: Add Post Excerpts till WordPress med hjälp av kod (lätt)

Om ditt WordPress-tema inte stöder excerpt av post som standard, kan du alltid lägga till den här funktionen manuellt.

Du kan editera dina WordPress-temafiler direkt, men vi rekommenderar att du skapar ett barntema istället. På så sätt kommer du inte att förlora de ändringar du har gjort när du uppdaterar ditt WordPress-tema.

Mer detaljer finns i vår guide för nybörjare om hur man skapar ett barntema för WordPress.

När du har gjort det måste du hitta den template som kontrollerar varje page där du vill visa excerpt av post. För de flesta themes kommer detta att vara home.php, content.php, category.php och archive.php.

För hjälp med att hitta rätt fil, se vår guide för nybörjare till WordPress mall-hierarki.

När det är gjort lokaliserar du helt enkelt följande kod i varje fil:

<?php the_content(); ?>

Ersätt sedan den här koden med taggen_excerpt:

<?php the_excerpt(); ?>

När du har gjort det, save filen och kontrollera sedan din website. Du bör nu se post excerpt där hela artikeln brukade vara.

Ändra standardlängden för excerpt i WordPress

Som standard visar WordPress de första 55 orden i varje post och addar sedan till en ellips (…) för att visa att det finns mer content.

Du kan ändra detta för att visa fler eller färre ord genom att lägga till kod på din WordPress website. Det är möjligt att edit-filerna för temat direkt, men det kan vara komplicerat.

Ett enkelt misstag kan också orsaka många vanliga WordPress error och kan till och med helt förstöra din webbplats.

Av den anledningen rekommenderar vi att du använder WPCode. Det gör det enkelt att add to code snippets i WordPress utan att behöva edit dina theme-filer. På så sätt kan du updating eller ändra ditt theme utan att förlora den anpassade koden.

Först måste du installera och aktivera det gratis pluginet WPCode. Mer information hittar du i vår guide för nybörjare om hur du installerar ett plugin för WordPress.

Efter aktivering, besök Code Snippets ” + Add Snippet-sidan från WordPress dashboard och klicka på knappen ”Use Snippet” under alternativet ”Add Your Custom Code (New Snippet)”.

How to show post excerpts using code

På nästa vy skriver du in en titel för code snippet. Detta är bara för din referens, så du kan använda vad du vill.

Därefter öppnar du dropdown ”Code Type” och väljer ”PHP Snippet”.

Customizing your post excerpts using code

När det är gjort klistrar du bara in följande i kod editor:

return 100;
}
add_filter('excerpt_length', 'new_excerpt_length');

// Changing excerpt more
function new_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');

Den här koden ändrar längden på excerptet för post till 100 tecken. Du kan ändra ’100’ till vilket nummer du vill.

När du har klistrat in koden, toggle omkopplaren från ”Inaktiverad” till ”Aktiv” i det övre högra hörnet och klicka sedan på knappen ”Save Snippet”.

Save and activate code snippet WPCode

För fler tips om hur du finjusterar dina post excerpts, vänligen se vår guide om hur du customize WordPress excerpts utan kod.

Metod 2: Add Post Excerpts med hjälp av hela Site Editor (endast Block Themes)

Om du använder ett av de nyare block WordPress themes, kan du add to post excerpts med hjälp av hela site editor.

För att komma igång, heada över till Appearance ” Editor i WordPress dashpanelen.

Using the full-size editor (FSE)

Som standard visar hela Site Editor ditt temas hemmamall, men du kan add to ett excerpt till vilken template som helst.

I menyn till vänster klickar du bara på ”Templates”.

Displaying post excerpts in WordPress using the full-site editor (FSE)

Du kommer nu att se en lista över alla templates som utgör ditt WordPress theme. Beroende på ditt theme kanske du vill lägga till excerpt till archive, index, search eller liknande templates.

Hitta bara den templates som du vill edit och gör det med ett click.

Displaying post excerpts using the WordPress full-site editor (FSE)

WordPress kommer nu att visa en preview av denna template.

För att gå vidare och edit mallen, click på den lilla penna ikonen.

Displaying post excerpts using the WordPress full-site editor (FSE)

Klicka nu på ikonen ”+”.

I den search panel som appear, skriv in ”Post Excerpt”.

Adding the post excerpt block to a block-based WordPress theme

När rätt block appear, drag and drop det till din layout.

Du kan upprepa den här processen för att add to flera post excerpts till templates.

Adding the post excerpt block to a block-based WordPress theme

För att finjustera hur excerptet ser ut, klicka bara för att välja blocket Post Excerpt.

I menyn till höger kan du börja med att välja om länken ”Läsa mer” ska visas på samma rad som excerpten med hjälp av toggeln ”Visa länk på new rad”.

Adding a read more button to a blog archive page

När du har gjort det väljer du tabben ”Styles”. Här kan du ändra textfärgen, add to en bakgrundsfärg, ändra storleken på fonten och mycket mer.

När du gör ändringar uppdateras live preview automatiskt, så att du kan prova olika settings för att se vad som ser bäst ut.

How to customize a WordPress post excerpt

När you är nöjd med hur post excerpt är inställt, click on the ”Save” button to make your changes live.

Vill du visa excerpt av inlägg på fler pages och posts? Då är det bara att upprepa stegen ovan, men den här gången väljer du en new template i menyn till vänster.

Metod 3: Add Post Excerpts till WordPress med hjälp av en Theme Builder (avancerad)

Om du vill ha fullständig control över hur archive, blogg page, homepage och resten av din site ser ut kan du skapa ett custom theme.

This allow you to design your own pages and show excerpts anywhere on your website.

SeedProd är den bästa WordPress-temabyggaren som allow you att enkelt skapa ett customize WordPress-tema utan att skriva någon kod. Det har också ett färdigt Posts block som du kan drag and drop på valfri page.

Note: Det finns ett gratis SeedProd plugin som allow you to create beautiful coming soon and maintenance mode pages, no matter your budget. Du behöver dock planen SeedProd Pro eller Elite för att unlocka theme builder.

Först måste du installera och aktivera SeedProd plugin. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett WordPress plugin.

Vid aktivering, gå till SeedProd ” Settings page och enter plugins license key. Du hittar den här informationen i ditt account på SeedProd website.

Adding a SeedProd license key to WordPress

När du har enter license key är du redo att skapa ett custom WordPress theme med hjälp av SeedProd theme builder.

Först måste du gå till SeedProd ” Theme Builder-sidan.

The SeedProd theme builder

Här kan du antingen använda en av de färdiga SeedProd site kits och templates som utgångspunkt eller manuellt skapa en template from scratch.

Vi rekommenderar att du börjar med ett befintligt theme, eftersom det automatiskt skapar alla nödvändiga templates-filer och ger dig ett försprång.

Med detta sagt klickar du på knappen ”Theme Template Kits”.

Creating a custom WordPress theme using SeedProd

Du kan nu välja någon av de templates som finns tillgängliga.

Alla dessa themes är helt anpassningsbara, så you kan finjustera dem så att de passar perfekt till din WordPress blogg eller website.

Choosing a theme template for your WordPress website or blog

När du har valt ett theme kommer SeedProd automatiskt att skapa all templates du behöver.

Du kan se detta som ett draft av ditt customize WordPress theme.

Customizing the blog, archive, and search pages using SeedProd

Du kan nu customize varje template med hjälp av SeedProds drag and drop editor.

Eftersom vi vill add to post excerpts till vår webbplats, hoverar du musen över mallen ”Blog Index, Archives, Search” och klickar på länken ”Edit Design” när den dyker upp.

How to add post excerpts to your WordPress theme with SeedProd

Detta kommer att hämta SeedProd drag and drop-byggaren.

Till höger ser du en preview av templaten. Som standard kommer mallen för bloggsidan att visa heading, archive, title och all your posts.

The SeedProd drag and drop theme editor and page builder

På vänster sida visas en menu med alla de olika block du kan använda.

You can add new blocks by dra them onto the page and then rearrange them by dra them up and down with your mouse.

Du kan customize vilket block som helst genom att clicka på det och sedan använda settings i menyn till vänster. När du gör en ändring kommer Preview Seedprod automatiskt att update för att visa dessa ändringar i action.

How to customize any block in a WordPress theme

Eftersom vi vill customize post excerpten, klicka helt enkelt för att välja ”Posts” blocket i live preview.

När du har gjort det väljer du det content som du vill visa i det här blocket med hjälp av inställningarna i menyn till vänster.

Du kan till exempel ändra layouten för kolumnerna, visa sidonumrering, visa featured image och ändra taggen för titeln.

How to add post excerpts to a WordPress theme without writing code

För att visa excerptet av posten klickar du bara på ”Show Excerpt” toggle så att den blir orange.

När du har gjort det kan du ändra hur många tecken SeedProd visar i excerptet genom att skriva ett new nummer i ”Excerpt Length”.

Adding blog excerpts to a WordPress theme

SeedProd kan också add to en ”Läs mer”-länk till varje excerpt, vilket uppmuntrar läsarna att öppna hela artikeln.

Du kan add to eller remove denna link med hjälp av ”Show Read More” toggle.

Adding a 'Read More' button to your post excerpts

You can also replace the ”Read More” text with your own message by typing into the ”Read More Text” field.

När du är nöjd med hur excerptet för posten är konfigurerat, click the ”Save” button in the upper right corner of your vy.

Customizing the 'Read More' link in a post excerpt

Du kan nu customize de andra SeedProd templates genom att gå till SeedProd ” Theme Builder och följa samma process som beskrivs ovan.

För att visa excerpten av posterna för besökare måste du först aktivera ditt SeedProd theme. För att göra detta, gå till SeedProd ” Theme Builder och klicka sedan på ”Aktivera SeedProd Theme” toggle så att den visar ”Yes”.

How to enable a custom WordPress theme using SeedProd

Nu, om du besöker någon av dina blogg pages, kommer du att se excerpten av posten live.

Bonus: Visa excerpt för lösenordskyddat content

Om du har en membership site kan det hända att du har en del content som inte är tillgängligt för den allmänna publiken. Det är dock fortfarande en bra idé att visa ett excerpt för ditt password-skyddade content.

Detta kan intressera användare och uppmuntra dem att köpa dina prenumerationer för att få tillgång till exklusivt content på din website.

Du kan enkelt göra detta med hjälp av Restrict Content Pro, som är ett populärt plugin för innehållsskydd. Efter aktivering öppnar du helt enkelt ett post som du gillar i WordPress Block Editor där du kan add to ett excerpt för det från block panelen.

Efter det kan du konfigurera dess begränsning från dropdown-menyn.

Add an excerpt for the restricted post

Publicera slutligen posten och besök sedan din WordPress site.

Här kommer användarna att kunna se inläggets excerpt och titel för det begränsade innehållet, precis som alla andra post. Själva innehållet kommer dock att vara dolt för publiken.

Protected content excerpt preview

Om du vill ha detaljer kan du också läsa vår tutorial om hur du visar ett excerpt av ett password-skyddat post i WordPress.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du visar excerpt av post i WordPress teman. Du kanske också vill se vår guide om hur du tjänar pengar på att blogga online med WordPress och våra expertval för de bästa tillägg och tools för sökmotorsoptimering i WordPress som du bör använda.

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

94 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. Manasi says

    for the plane these this is what worked for me – Go to the home page and clkick edit. Go to the block editor and click on the block – Blog Posts. You will seea setting which states ’post control settings’

    There you can enable or disable the show excerpt setting

  3. Dicado says

    Hi thanks for this. I don’t have those files in my child theme. If I just go ahead and do this in my parent theme, won’t it be erased if there is an update?

    • WPBeginner Support says

      Correct, if you place it in your parent theme and the parent theme is updated your changes would be lost

      Administratör

  4. John says

    Thanks for this post. I also want to ask for help on how to add padding around excerpt. I have added border lines around my excerpt; the problem is the excerpt is touching the borderlines. How do I add padding around the excerpts, preventing it from touching the borderlines? Thanks in advance.

  5. Atul Jagtap says

    Hi their,
    I am using ’Enlightenment’ theme but I have a problem that in my post I can’t see the short Post Excerpt ie it’s come blank. And this happened only with ’Enlightenment’ this theme. Because same code I am using in other theme is working fine. So is anybody give me solution on this?

  6. Sara Pedersen says

    Hello

    I have custom excerpt in the excerpt box for each post. They are a photo link. This has worked for several years and the photo is at the top of the post with the post link below. Suddenly the last 2 posts the excerpt photo is not posting. Any tips to fix this?

  7. Siddhesh says

    Hi,

    I can locate index.php and categories.php in my theme folder but i dont find the mentioned syntax. How do i fix this?

    -Siddhesh

  8. Francesco says

    Hi, maybe my question will sound silly to you but… I never installed WordPress on a server/host, I just suscribed and got the .wordpress.com domain, everything was automatic. So, how can I access these files? I read in the comments about the FTP protocol, which I am familiar with, but who gives the information to enter in the domain with that?

    And while we’re at it, do you suggest to install wordpress by yourself (online I see there are a lot of tutorials and seems easy to do) or continuing as I am doing on the .wordpress.com domain? Maybe one day I will buy the premium and have a direct domain, but besides that, are there any advantages in terms of functionality in installing manually?

  9. Joseph Dabon says

    Very simple, huh! But where can I find these? – index.php file, archive.php file, and category.php

    • Javier says

      Hi, you can find those files using a FTP account.

      When you get in to your server files, get in into this route:
      wp-content/themes/ your-theme-name /

      And you will find the files

  10. Tolu says

    Hi there,
    My theme doesn’t support excerpts on the homepage, i’ve enabled excerpts on the blog post and its still not showing on the homepage, i’m not a php pro so i don’t know my way around it.

    Any help would be appreciated.

  11. Sreeharsh says

    Hi, My theme doesn’t support excerpts in the posts page.
    Can you please help me to enable it to display under my page title.
    Thank you. :D

  12. javad says

    hi
    my theme have excerpts option and i enabled it

    and i want to show my post images above this excerpts on index,php

    i used Auto Post Thumbnail and Featured Image plugins

    but i dont know code to show Thumbnail above the posts

  13. Dorine Ogutu says

    Hello, I am a beginner and I am using the Nucleare theme. I can’t find the index.php file. Please help.

    Desparate

    • Constantine says

      You will need to open either the terminal or your cPanel (if you’re using a shared host and it provides this feature), find your wordpress directory, and under the directory there’ll be a folder called ”wp-content”, then enter ”themes”, and then find the one folder that the name is your currently using one.

      If you’re using a terminal,

      type

      cd /…/…/wp-content/themes/

      and use cd to enter your themes folder that’s where your index.php lies. ”…” here means your previous directory of your wordpress root directory, you will need to find that yourself and figure out what it is first you installed your wordpress on your server.

      Not sure if this helps since it’s been awhile, i’m a newbie myself so hope it might help you and others.

  14. Chris says

    I’ve just updated to a responsive theme and all the posts were in excerpt form. From reading this column I was able to change them to full content. What I’d really like is to have my current post in full content mode, so my followers see it as soon as they get on my site, and the older posts in excerpt form, so that the site loads more quickly. Is this possible? Thanks for your help!

    • James says

      @Chris, I’m trying to do the same thing. Did you figure this out (how to show the latest post in full mode, and the rest as ”excerpts”)?

  15. Gaurav says

    I am using custom excerpts from wordpress. It is displayed on my home page. But it is not displayed on my original post. I want to display this excerpt just before my actual post with different font styles and font colour.
    Is there a way to do that ?

  16. pase says

    Trying to display a list blog excerpt summary after the blog introduction. Created a custom template for the blog front page. How can I call the blog excerpt summary page from the custom template?

  17. Drew says

    you know there’s a plugin that can resolve this. with ANY tutorials, it’s never 100% clear because there are files or scripts that are different or not available…pending multi-site install or single-site install etc etc. even with your simple instructions, i couldn’t find the proper tag to replace…so i just downloaded a plugin and 1 minute later…fixed.

    • Dawn Youngs says

      I am working in the Organization Theme on WordPress.com. I have managed to set up a static Home Page and a Blog Page which displays my recent posts. I have chosen the summary options for each article in my feed, but when I publish the page I see the full text of each post on my Blog Page. I have set featured images and I have Written Custom Excerpts for my pages and I want a Blog Page displays the excerpts and images with a link to the post page. How in the world do I do this? What is going on with no change between summary and full in the reading section of my settings? Is this an issue with the theme or a general problem in WordPress? I just want a clean simple page that shows a series of excepts for a weekly report, please help!

      By the way, I do not know how to open my files, I cannot even find my file directory, and wonder if it is hidden from me because I am in .com and not hosting the site myself like in .org?

  18. Rahul says

    I have used experts for some of my posts but i found a problem, special signs like,”! are not rendering properly and there’s some utf-8 problem… can you guys conform whether its a WordPress problem or my hosting. Though the problem only causes in my excerpts (summary) but the article with ”are opening up fine” and can be read properly. If its a WordPress issue please let us know if there’s any solution to it.

    Thanks,
    RAHUL

  19. Seth says

    I am using the twentythirteen template. None of the files mentioned have ”the_content” in them. Also, there is no longer a ”loop.php” file. (I only want my archives – tag and category to have the excerpt).

    This is what I see in the archives.php and category.php:

    Changing ’content’ to ’excerpt’ also doesn’t seem to do the trick.

      • Imoteda says

        whenI change it in content.php, I can no longer see the full posts on any pages. Clicking on the continue reading link gives me the same excerpt

        • Jenn says

          I’m having the same issue. I successfully changed the_content to the_excerpt. This makes my blogroll successfully show the excerpt instead of the full post. However, when I click into a post, only the excerpt is shown. Is there a way to modify the single.php file to guarantee the entire post content is displayed when viewing a single post? Any advice is really appreciated!

  20. lester says

    finally . . . . FINALLY !!

    i FINALLY found an answer to a problem with wordpress.

    for the love of God and flowers and good food and wine!

    thank you !! thank you !! thank you !!

  21. Daniel Z says

    Thanks! This worked like a gem in the inStyle theme by Elegant Themes. I actually had to edit the code in home.php, but thanks for leading me in the right direction.

  22. Trenton Miller says

    This is great, it’s working for me now. I would like to have the images that I have at the beginning of blog posts that I inserted via HTML, not the Featured Image method. On the blog posts where the image is within the first 55 characters, or whatever you set it to, how can I get it to appear? Is there something extra to add into functions.php?

    • Editorial Staff says

      Automatic excerpts do not show HTML elements. You have two options. Either write a custom excerpt using the excerpts field in your write panel. If you don’t see it, then look at the top right hand corner ”Screen Options”. The other option is to use the_content, and utilize the more tag.

      Administratör

      • Caroline says

        Ouuch – thanks for your comment. I was searching for hours for this information. Such simple but well hidden if you don’t know how to add individual excerpts. Was looking to change the php files but did not dare for missing experience. All set now, thanks again.

  23. Dr. Erika says

    This is AWESOME. Seriously thank you wpbeginner for all your articles.

    Any idea of how to add pictures to the displayed excerpts?

  24. Bridget says

    OMG dude, thank you so much for this! I literally spent like 45 minutes trying to figure this out with an elegant theme, only to find that your solution took about 12 seconds. Gahh! Oh well, all is well that ends well! Thanks!

    • Deepak says

      Hye Sudip,
      Open any post to edit. On the top of it you will find the screen option. Click on that , then you will see so many options there. Then go to the excerpt option , check on that option. Then below the title and content box, you can see the excerpt box .You can write your excerpt content there.

  25. Jay Madisson says

    Hi,

    Im just wondering, where can I find the (Open your index.php file, archive.php file, and category.php file.)? Sorry for being a noob in HTML :(

    Cheers,

    Jay MAdisson

    • Jerry says

      I’m sorry, are we speaking here of files that reside on my computer? I thought the whole blog was done online. I have no software for WordPress on my computer. I have not downloaded anything. What am I missing? Does one have to know HTML code to blog?

  26. Rich says

    Hello, I’m using the 2010 theme on the blog and it didn’t change to when I replaced content with the word excerpt. Is it something I’m leaving out??

  27. Emma says

    I am using the new twenty twelve theme to base a child theme on and cannot get excerpts to work at all. I looked in all the files you suggest above, but cannot find
    in any of them. Similar to Heather I have imported my blog from blogger too…
    There also doesn’t seem to be a loop.php file
    Help!

      • Emma says

        Thanks for this – I changed entry-content in content.php to

        and it has worked!

        The problem I have now is how to get the excerpt text to wrap around the thumbnail, which I would like to float either right or left.

        Any ideas?

        Thanks

  28. Erin says

    Maybe you can help me here. There is no in any of the files you listed above; index.php, archive.php, or category.php. This is the closest thing that I see (from my index.php file).

    Can I change something in this code or add some new code?

    • Editorial Staff says

      If none of those files exist, that means you are using a child theme. You will have to utilize the hooks in the parent theme framework. We don’t write tutorials specific for theme frameworks.

      Administratör

  29. Chris says

    I’m using the twentyeleven theme and ”the_content” does not appear in any of the three files mentioned. I’m stumped.

  30. HemantKokcha says

    I am trying to get excerpt but i cant get excerpt by both of your method so tell me correctly how wll i get excerpt in traction theme.

    • wpbeginner says

      @HemantKokcha There is only one method… changing the_content to the_excerpt… The other function is to controlling excerpt length and the excerpt read more. If its not showing in your theme, then perhaps try contacting the theme author. Because this is the only way of doing it.

  31. clwdk says

    Hi there,

    I am using the newest version of the twenty ten theme and am not sure where to change the <?php the_content(); ?> to <?php the_excerpt(); ?>. There is nothing in the index.php as far as I can see. Am I overlooking something? Thanks for any help you can give me.

    CARL

  32. wpbeginner says

    @Ibadullah You have to add this code in your theme’s functions.php file. It should work perfectly fine because this is the way to do it, and we are doing it on our site.

  33. Ibadullah says

    @wpbeginner@Ibadullah I am saying when I add the number in post excerpt – I just see the same number on main page. such as I type 50 in the post excerpt field it show Category name : APPLE and instead of content it show number 50

  34. nescafespk says

    <a href=”http://www.games-masti.com” title=”Play Online Games”>Play Online Games</a>

    This is very nice trick and thanks for help us and thanks for the whole team of the word press team

  35. Carl says

    Great – thanks. Was looking for a simple solution. How do you include a Read more… link after the excerpt also though?

  36. Heather says

    Thank you for the article. I made the changes in all 3 documents and nothing changed. All of the posts on the blog I am working on were imported from Blogger, could that be an issue or perhaps the theme itself? I am stumped!

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.