Forums

Custom Fields on Thematic Child Theme (4 posts)

  1. iblob
    Member
    Posted 8 months ago #

    I am trying to figure out how to add custom fields to posts within a specific category. I am using a child theme under Thematic that I created. The custom fields will only be used for this one category. Posts with this category should have a special layout. Posts in other categories need to have the standard loop.

    Please forgive me, I know next to nothing about coding for WordPress and need to know exactly what to do to get this to work. I looked at various tutorials but I don't know what I am missing, it just isn't making sense to me. Please could someone help me out here? I appreciate any help. Thank you.

  2. vtxyzzy
    Member
    Posted 8 months ago #

    It seems to me that you do not need custom fields. You can create a category-specific template that will only be used for the one category. See the Codex article below for more information.

    http://codex.wordpress.org/Category_Templates#What_Template_File_is_Used.3F

  3. iblob
    Member
    Posted 8 months ago #

    Thank you for your reply. Looks like that would work to get it to show for only certain categories.

    However, I would still need to use custom fields though, as I have URLs, and general text that needs to be put into specific fields. How would I stick the fields into the category template?

    Thanks.

  4. vtxyzzy
    Member
    Posted 8 months ago #

    You retrieve custom field values with the get_post_meta() function.

    So, for example, if you have a CF named 'my-text', you would get the value like this:

    <?php $my-text = get_post_meta($post->ID,'my-text',true); ?>

    Then, in your template at the place you wanted to insert the text, you would use this:

    <?php echo $my-text; ?>

Reply

You must log in to post.

About this Topic