PDA

View Full Version : do you like custom fields


slee
10-27-2008, 03:51 PM
In workdpress you can extend the information that you can put in by using Custom fields, do you use them?

Are you for or against using them?

athlon24
10-27-2008, 04:16 PM
I am thinking about it quite some time. Because I want to add a tagline for my title post. but my problem is I don't know how to call it and use it. :D

slee
10-27-2008, 04:44 PM
you can use custom fields for that but if you can hang on a day or so ill be releasing a plugin that will allow you to do just that :)

sarahG
10-27-2008, 05:06 PM
custom fields are easy to use and yes I use them. In fact, the All in One SEO pack uses them, as does my Page Menu Editor plugin. The only difference is you get 'pretty' boxes below your content area and add/update the content there rather than searching through the custom fields, however for a quick solution they're fine.

In fact I'm currently setting up a multi language site using WordPress and needed to change the language specified in the HTML tag depending on the language of the page, so I just used a custom field for this. Less chance of the client looking in there and changing it!

to get a Custom field just use

get_post_meta($post->ID, 'fieldname', TRUE);

Where 'fieldname' is the name you've given your field in the Write page.

athlon24
10-27-2008, 05:18 PM
mmm, I am poor in coding and stuff but what I want to do is to put a subtitle under the title of my post. If their is a subtitle, it will appear but If there is none, of course, I don't need to put it. What I know is I need to edit my singlepost.php to do it. From there, I'm lost.

fayans
10-27-2008, 06:01 PM
The only time I use a custom field is to insert an image to my featured article and that's pretty much what I know about it. I read an instruction on one of the blog that gave a step by step instruction on how to create an extra custom field but it was too technical I had the slightest clue on how to get it started.

sarahG
10-27-2008, 08:38 PM
When you create your post (or page) lower down you have the custom fields area. You can create a new key or, once it's created once, select it from the drop down list. So for example athlon wants to create a subtitle. So he would create a new key called subtitle (just once as it'll be in the drop down list next time for any new and existing post).

Give the subtitle key a value in the text box on the right. Then when you save the page this custom field is saved.

In your single.php page (or page.php for a page) you then would put

<?php
$subtitle = get_post_meta($post->ID, 'subtitle', TRUE);
if (!empty($subtitle)) echo "<p id='subtitle'>".$subtitle."</p>\n";
?>

Where you want the subtitle to appear.

Now if you go to edit another post/page or create a new one, when you open up the custom fields section and click the drop down list you'll see subtitle as an available key. Select that and fill in the value for that particular post/page.

athlon24
10-28-2008, 02:10 AM
I will definitely try this one. I'll get back into this once I finished my post for the weekend.

Jeffro
10-28-2008, 06:54 AM
I used custom fields for a while in a theme I used to display a 100X100 thumbnail next to every post on my main blog page. However, configuring this custom field each time I wanted to publish a post made the post publishing process one step longer and I have since gotten rid of that part of the theme.

silent_thunder
10-28-2008, 07:39 AM
My theme use them,Ikarus for the featured posts and images there are seperate custom fields its easy to use once you get used to