De zeer Gemakkelijke Houwer van het Thema Wordpress: Toon de Beelden van de Categorie
4.756 meningen -Gepost in:
4.756 meningen
Gelieve van nota te nemen: Deze pagina werd oorspronkelijk geschreven in het Engels.
De originele post kan worden bekeken hier.
Please note: This page was originally written in English.
The text has been translated using an online service such as Google or Babelfish.
The original post can be viewed here.
Ik ga u tonen hoe te om n of andere eenvoudige PHP code toe te voegen aan uw malplaatje Wordpress en verbonden beelden te maken in plaats van tekst voor uw categorien in posten verschijnen. Allen u moeten weten eenvoudige PHP, wat basisHTML, en hoe te om uw eigen grafiek te maken is.
** UPDATE ** Mei 2008
Zoals de laatste commentaar aan het eind van deze pagina toont is er nu a De Pictogrammen Wordpress Plugin van de categorie u kunt downloaden installeren om uw categoriepictogrammen in uw dashboard net te leiden. Als u verkiest uw thema te binnendringen in een beveiligd computersysteem, zal de code hieronder enkel fijn werken! Het koele ding over plugin is dat zij u manieren geven om n of veelvoudige categoriepictogrammen te doen, maar ook methodes om pictogrammen met uw categorien in de zijstaaf eveneens te zetten! Ik ben altijd zeer dankbaar wanneer een goede plugin zich voordoet! Nu terug naar de originele post…
Hebt u ooit Wordpress enkel het doen maken willen en e binnendringen in een beveiligd computersysteem en iets u het altijd wilde doen? Ik denk van dingen ik het niet altijd de hele tijd wil doen maar de uren heb aan het vinden van het antwoord te wijden. Ik heb gezocht naar PHP codesnippets voor Wordpress en leerprogramma's en hoe-aan artikelen eveneens en veel niet gezien die me werkelijk hielp. Tot vandaag - toen ik las de pagina van een priv-leraar in WPDesigner vandaag. Ik werd precies niet de code die ik, maar vrij heb gewenst gesloten. Ik moest enkel het binnendringen in een beveiligd computersysteem een beetje om het ertoe te brengen om te doen wat ik wilde.
Eerst, veronderstelt deze houwer Wordpress van een priv-leraar een paar dingen.
- U hebt uw Wordpress malplaatjecode voordien gewijzigd
- U kunt eenvoudige PHP wijzigen
- U kunt eenvoudig HTML schrijven
- U kunt uw eigen grafiek maken
Eerste dingen eerst - is hier de code:
<h3>< B> Gepost in: </b>< /h3>
<? php foreach ((get_the_category ()) als $cat)
{
$catname =$cat-> category_nicename;
weergalm een „<href \ „/category/“;
echo $catname;
echo „/\“> „;
echo „<img src \ „/wp-content/cat-pictogrammen“;
echo $catname;
echo ".png\" alt=\"$catname category image\" border=\"0\" /></a>\n";
}
?><br />
I hacked this code from this tutorial page on WPdesigner. The code they had was only good to display one category per post. I hacked it because my blogs all have posts assigned to multiple categories. Also, I wanted the images to all be linked so people can just click them and go right to that category page. Let’s look at the pieces of this code you might need to modify.
In line 1, you might want change “Posted in:” to alternate text like “Filed under:”, etc.
In line 5, if your permalink structure is different than the default, you may need to change /category/ to what you are using.
In line 8 change /wp-content/cat-icons/ to wherever you will be storing your category icons in your site.
In line 10, if you are using gif’s or jpg’s change .png to your graphic file format.
Now all you have to do is create one image for every category you have an place them in the folder you just created on the server. Make sure that the graphics are named exactly as your categories, and if your categories have multiple words just add a hyphen in between each word. That’s it! All you have to decide now is where you want these category icons to appear, before or after your post - and add them into the appropriate place. I placed mine just after the title of the post on my single post pages - as you can see at the top of the post on this page. You can hack this category icon code a hundred other ways to do what you want. I think in the future I’m going to use it to replace the text category links in my sidebar. The only caveat to this (and the code hack above) would be the fact that if you don’t have an image a text link will display (in FF, or broken image in IE). So - if you create new categories in the future, make sure you create a new image for each.
My Blogging Mistake for this post is that I didn’t decide to customize and hack my Wordpress Theme before now to create my own layout. Do you have a question or a new way to hack up this wordpress category icon PHP code? Comments and post it now!





















January 8th, 2008 at 10:40 am
This was very easy to do - thanks for the code and the tip!
The Smorgasbord’s last blog post..Convert Vinyl Records to MP3
January 24th, 2008 at 9:47 pm
[...] Imágenes para las categorías [...]
January 25th, 2008 at 4:49 am
25 неотстойных хаков для WordPress
Динамическое слайдшоу в шапке — позволяет крутить картинки в шапке вашего блока, придает динамику; демоверсия.
Пузырь комментариев — гр…
January 25th, 2008 at 8:52 am
[...] Imagens para categorias. Adiciona imagens para cada categoria do seu blog e são mostradas no post se você preferir. [...]
January 27th, 2008 at 2:48 pm
[...] Imagens para categorias. Adiciona imagens para cada categoria do seu blog e são mostradas no post se você preferir. [...]
March 9th, 2008 at 12:13 am
[...] Show Category Images (Source: [...]
March 13th, 2008 at 12:40 am
[...] Show Category Images (Source: [...]
March 13th, 2008 at 1:51 am
[...] Show Category Images (Source: [...]
March 16th, 2008 at 6:43 pm
[...] 10)Show Category Images- How to add some simple PHP code to your WordPress template and make linked images appear instead of text for your categories in posts. [...]
March 17th, 2008 at 9:40 am
Great hack! thanks
March 23rd, 2008 at 7:40 am
[...] Show Category Images (Source: [...]
April 12th, 2008 at 12:18 pm
[...] sticky”- When we need to have certain articles ’stay at the top’ longer than others. 10)Show Category Images- How to add some simple PHP code to your WordPress template and make linked images appear instead [...]
April 15th, 2008 at 2:02 am
Hi
here is a plugin that do the job :
Category Icons Plugin.
April 19th, 2008 at 10:47 am
That is a very nice Hack! I realize there is a plugin now, but I think I am going to just edit this in one of my projects. Thanks for writing it down!
April 21st, 2008 at 9:02 am
[...] : JTPRATT’s Blogging Mistakes ( here & here ), Performancing Helping Bloggers [...]
April 27th, 2008 at 9:50 am
[...] 84. No More CSS Hacks. 85. Create a Dynamic Sticky. 86. Styling Individual Posts Using the_ID. 87. Show Category Images. 88. Separate WordPress Comments and Trackbacks. 89. Customize your WordPress Login. 90. Date Image [...]
May 16th, 2008 at 2:26 am
[...] 84. No More CSS Hacks 85. Create a Dynamic Sticky 86. Styling Individual Posts Using the_ID 87. Show Category Images 88. Separate WordPress Comments and Trackbacks 89. Customize your WordPress Login 90. Date Image [...]