Skip to main content
All CollectionsTroubleshooting and FAQsFrequently Asked QuestionsBlog Module
How to Customize the Blog Module to Display Post's Custom Fields
How to Customize the Blog Module to Display Post's Custom Fields

Customize the Blog Module to display Custom Fields assigned to each Post.

Updated over a week ago

Note: The following customization requires an active Divi Child Theme and the Blog.php file to be moved to the child theme folder.

  1. Ensure that the Child Theme is active, and it contains the Blog.php file

  2. Go to WordPress Dashboard β†’ Appearance β†’ Theme Editor

  3. From the right sidebar, select the Blog.php file

  4. Search for this line of code:

    echo '<div class="post-content">';

  5. After that line of code, add this new line:

    echo (get_post_meta($post->ID, 'my_key1', true) != '') ? '<div class="mykey1">'. get_post_meta($post->ID, 'my_key1', true) . '</div>' : "";

    Customize the Blog module to display custom Post's custom fields

Important Notes:

  1. In the PHP code above, the name of the custom field is my_key1

  2. The my_key1 will have to be replaced to match your Custom Field's name

  3. If you have more custom fields that you want to show for each Post that is being displayed by the Blog module, duplicate the line of code that was added in Step 5 and make sure the correct Custom Field's name is used.

  4. You can learn more about Custom Fileds by checking WordPress's official documentation

Did this answer your question?