How to get certian fields to display on post types

Hey team,

I was using this archived content to help me get the custom fields to show with advanced custom fields but nothing is showing up.

I believe I’m using integrity and placing the new php code in the child theme but two questions:

  1. How does wordpress know to pull that new info from the child theme?
  2. Where in the child theme php file do I place the code that was generated from the advanced custom field plugin?

Please don’t reference these two articles:

as I have walked through them twice.

Just looking where to place the new php code in X – Child Theme: wp-single.php (framework/views/integrity/wp-single.php) php code so the fields appear.

Attached is the file I’m referring to.

Here is the test post as well: https://www.ownersforum.ca/this-is-a-test-group/

Cheers

Hi Jonny,

You are editing the correct file for single post type on a child theme.

Though you do have errors on your custom code.
First, php code should be using correct syntax:

  <?php function nameofyourfunction(){
 //  process here. Make sure the correct open and close bracket are added on the function.

} ?>

Correct syntax is important. Then if you have caching please make sure to clear cache. If you are not familiar with coding, it would be best to consult a web developer. Thank you for understanding.

Hey Lely,

Thanks for getting back to me.

I am familiar with coding just new to using the themeco dashboard.

The first photo is the default code from themeco. Just wondering where inside do I add the new php code?

Hello Jonny,

Thanks for writing in!

You will have to add your custom functions in your child theme’s functions.php file. For example;

<?php

// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Overwrite or add your own custom functions to X in this file.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Enqueue Parent Stylesheet
//   02. Additional Functions
// =============================================================================

// Enqueue Parent Stylesheet
// =============================================================================

add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );



// Additional Functions
// =============================================================================

// Custom Function
function nameofyourfunction(){
 //  process here. Make sure the correct open and close bracket are added on the function.

}

And then you call your custom function in the template file like the wp-single.php file

<?php

// =============================================================================
// VIEWS/INTEGRITY/WP-SINGLE.PHP
// -----------------------------------------------------------------------------
// Single post output for Integrity.
// =============================================================================

$fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true );

get_header();

?>

  <div class="x-container max width offset">
    <div class="<?php x_main_content_class(); ?>" role="main">

      <?php while ( have_posts() ) : the_post(); ?>
        <?php x_get_view( 'integrity', 'content', get_post_format() ); ?>
        <?php x_get_view( 'global', '_comments-template' ); ?>
      <?php endwhile; ?>

      <?php nameofyourfunction(); ?>

    </div>

    <?php if ( $fullwidth != 'on' ) : ?>
      <?php get_sidebar(); ?>
    <?php endif; ?>

  </div>

<?php get_footer(); ?>

These codes were all just examples used for explaining where you can place the custom codes. We would love to know if this has worked for you.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.