• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    https://codex.www.ads-software.com/Category_Templates#What_Template_File_is_Used.3F

    Thread Starter iblob

    (@iblob)

    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.

    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; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Fields on Thematic Child Theme’ is closed to new replies.