Title: Adding Child Theme, Custom Post Type, Custom Fields
Last modified: May 9, 2019

---

# Adding Child Theme, Custom Post Type, Custom Fields

 *  [craigtommola](https://wordpress.org/support/users/craigtommola/)
 * (@craigtommola)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/)
 * I have created a Custom Post Type, named Resources.
    I have added custom fields
   to Resources with Advanced Custom Fields. I have created /single-resource.php
   and /templates/content-single-resource.php in my child theme. However … I cannot
   seem to track down precisely where in these files (or elsewhere in a child theme)
   where I should make modifications to output my custom field content.
 * Are there additional Parent Theme resources I need to duplicate? An atypical 
   way of outputting custom content?
 * Much thanks
    CT

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [craigtommola](https://wordpress.org/support/users/craigtommola/)
 * (@craigtommola)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11513331)
 * PS … Every time I try to add content to /templates/content-single-resource.php,
   I get this:
    “The site is experiencing technical difficulties.”
 *  Thread Starter [craigtommola](https://wordpress.org/support/users/craigtommola/)
 * (@craigtommola)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11513505)
 * PPS … throughout the theme, you’ve misspelled “summary”
    `$summery = 'full';`
 *  [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * (@britner)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11514519)
 * Hey,
    When using advanced custom fields you should see which PHP calls to add
   to get those fields to output. Can you tell me what you are adding? Have you 
   talked with Advanced custom fields?
 * What content are you adding to the file? Can you send me the file code, that 
   error usually means you have a markup error in your code.
 * Thanks for the note on summary, I am in the process of a complete rewrite of 
   virtue and that will be changed.
 * Ben
 *  Thread Starter [craigtommola](https://wordpress.org/support/users/craigtommola/)
 * (@craigtommola)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11514562)
 * I was able to add content after I created a new div.
    I have spoken to ACF. The
   most recent question being:
 * Ok – this is puzzling … how come this works:
    `<li><?php $facebook= the_field('
   facebook'); if ($facebook != '') {echo $facebook; } ?></li>`
 * But not this:
 *     ```
       <?php 
       	$facebook= the_field('facebook');
       	if ($facebook != '') {
       			echo "<li><a href=\"".$facebook."\" class=\"fab\">".$facebook."</a><li>";
       		}
       ?>
       ```
   
 *  Thread Starter [craigtommola](https://wordpress.org/support/users/craigtommola/)
 * (@craigtommola)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11514636)
 * Got it to work like this:
 *     ```
       <?php if( get_field('facebook') ): ?>
       <a href="<?php the_field('facebook'); ?>"><li><?php the_field('facebook'); ?></li></a>
       <?php endif; ?>
       ```
   
 *  Thread Starter [craigtommola](https://wordpress.org/support/users/craigtommola/)
 * (@craigtommola)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11514793)
 * Since you’ve moved all the post content into hooks, it makes it especially difficult
   to make custom post types and have unique output and formatting. Perhaps moreso
   in a child theme.
 * For example, I have the custom post type Resources. On the Resources “single”
   page I want to remove the Author and Comment count. And include the featured 
   image.
 * Generally in child theming, I’d duplicate the single, perhaps a template-part,
   and customize. But all the pieces are separated into the /lib/template_hooks/
   post-hooks.php
 * How do you recommend I customize a custom post type in a child theme of Virtue?
 *  [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * (@britner)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11514957)
 * Hey,
    You can do this with hooks in your child theme for example:
 *     ```
       add_action('init', 'custom_child_init');
       function custom_child_init() {
       remove_action( 'virtue_single_post_after', 'virtue_post_authorbox', 20 );
       add_action( 'virtue_single_post_after', 'virtue_post_authorbox_only_posts', 20 );
       }
       function virtue_post_authorbox_only_posts() {
       if ( get_post_type( get_the_ID() ) == 'post' ) {
       virtue_post_authorbox();
       }
       }
       ```
   
 * That unhooks the author box from the post footer hook and then rehooks the author
   box back in only for the post type “post”.
 * Usually though if you have a custom post type you don’t want anything from the
   blog post type since the blog is set up so differently so in your custom template
   you would not add any blog post type actions, instead you can either use your
   own actions or simply add in the content you want to use.
 * Let’s say for example I want the template to output the title without outputting
   the metadata which runs through the virtue_single_post_header hook.
 * In your custom post type template you can just add `the_title();` function
 *     ```
       echo '<h1 class="entry-title">';
           the_title();
       echo '</h1>';
       ```
   
 *  [hopetommola](https://wordpress.org/support/users/hopetommola/)
 * (@hopetommola)
 * [7 years ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11554672)
 * Re: your earlier mention of rewriting Virtue – here’s a thought … regarding the“
   homepage” style, I suggest attaching those configurations to a “homepage page
   template” as opposed to “is_front_page()” then you can build multiple versions,
   or replace your homepage without developing the content live.
 *  [hopetommola](https://wordpress.org/support/users/hopetommola/)
 * (@hopetommola)
 * [7 years ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11554675)
 * Also – review the default design settings for ADA compliant contrast (specifically
   in the default “icon boxes”)
 *  Thread Starter [craigtommola](https://wordpress.org/support/users/craigtommola/)
 * (@craigtommola)
 * [7 years ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11573407)
 * So … those above comments were also me, just a diff login. Anyway… I have a custom
   post type with custom fields. I’m outputting something to this affect:
 * <h1><?php the_title(); ?></h1>
    <?php the_content(); ?> <div class=”resource-
   contact”>(ACF output of contact info)</div> <div class=”resource-social”>(ACF
   output of social media links)</div>
 * I like the automatic “related posts” it’s picking up from my custom post type.
   However, it appears to be hooked to <?php the_content(); ?> and is therefore 
   appearing _between_ the post content and my ACF output.
 * How might I “move” the related posts to, say the <footer class=”single-footer”
   > for example?
 *  [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * (@britner)
 * [7 years ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11576794)
 * > I like the automatic “related posts” it’s picking up from my custom post type
 * That isn’t from the theme, likely you are using jetpack?
 * Check out this post: [https://winningwp.com/how-to-reposition-jetpacks-related-posts-module-and-other-customizations/](https://winningwp.com/how-to-reposition-jetpacks-related-posts-module-and-other-customizations/)
 * Let me know,
 * Ben

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Adding Child Theme, Custom Post Type, Custom Fields’ is closed to new
replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/virtue/3.4.15/screenshot.png)
 * Virtue
 * [Support Threads](https://wordpress.org/support/theme/virtue/)
 * [Active Topics](https://wordpress.org/support/theme/virtue/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/virtue/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/virtue/reviews/)

 * 11 replies
 * 3 participants
 * Last reply from: [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/adding-child-theme-custom-post-type-custom-fields/#post-11576794)
 * Status: not resolved