Title: Custom fields, Schema markups
Last modified: January 9, 2025

---

# Custom fields, Schema markups

 *  [hassanb](https://wordpress.org/support/users/hassanb/)
 * (@hassanb)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/custom-fields-schema-markups/)
 * Hi,
 * I tried to use custom fields for schema markups without success.
   Please what 
   can I add to functions.php ?Can I use Child Theme or Parent Theme ?

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

 *  [Aradhy Singh](https://wordpress.org/support/users/bsfaradhy/)
 * (@bsfaradhy)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/custom-fields-schema-markups/#post-18241524)
 * Hi [@hassanb](https://wordpress.org/support/users/hassanb/),
 * You can use the child theme to add the custom code. Here’s a quick guide to help
   you get started: [[Link to Guide](https://wpastra.com/docs/add-custom-php-code/#3.-in-child-theme)]
 * Kind regards,
    Aradhy 🙂
 *  Thread Starter [hassanb](https://wordpress.org/support/users/hassanb/)
 * (@hassanb)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/custom-fields-schema-markups/#post-18261061)
 * Hi, thank you,
   I have added this code to the Child Theme but I got no results.
 *     ```wp-block-code
       // Fonction pour afficher le schema markupfunction display_schema_markup() {    if (is_single()) {        global $post;        $schema_data = get_post_meta($post->ID, 'schema_markup', true);        if ($schema_data) {            echo $schema_data;        }    }}add_action('wp_head', 'display_schema_markup');
       ```
   
 *  [Aradhy Singh](https://wordpress.org/support/users/bsfaradhy/)
 * (@bsfaradhy)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/custom-fields-schema-markups/#post-18267199)
 * Hi [@hassanb](https://wordpress.org/support/users/hassanb/),
 * Could you please try switching to a different theme and then adding the code 
   to that theme’s child theme? This will help us determine whether the code is 
   functioning as expected.
 * Kind regards,
    Aradhy 😊

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

The topic ‘Custom fields, Schema markups’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/astra/4.13.4/screenshot.jpg)
 * Astra
 * [Support Threads](https://wordpress.org/support/theme/astra/)
 * [Active Topics](https://wordpress.org/support/theme/astra/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/astra/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/astra/reviews/)

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * 3 replies
 * 2 participants
 * Last reply from: [Aradhy Singh](https://wordpress.org/support/users/bsfaradhy/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/custom-fields-schema-markups/#post-18267199)
 * Status: not resolved