skip to Main Content

Theme: Divi
Plugin for custom fields in post: ACF – Advanced Custom Fields

Using the Divi Blog module in Grid mode, I want to show a custom field (registered using the ACF plugin) alongside the post title, author, excerpt, post date, etc.

See the blue line in the screenshot to give you an idea.

enter image description here

Is there a way to have the Divi Blog module display a ACF field? Perhaps a editing the module function?

Thanks in advance

2

Answers


  1. Divi provides an option to include Dynamic Content into Divi Builder. Not sure whether this works for the DIVI Blog Grid layout. Just give it a try and see if it works for you.

    https://www.elegantthemes.com/blog/theme-releases/dynamic-content-for-divi-is-available-now

    Login or Signup to reply.
  2. Just did this successfully.

    1. You first have to move the Blog module into your child theme using these instructions: https://intercom.help/elegantthemes/en/articles/4532734-moving-blog-module-in-child-theme
    2. In your new, child theme Blog.php file, find the section that starts with the comment "Filters Blog module’s main query." For some reason there were what appeared to be two of this entire section in my file so make sure you’re editing the last instance of this.
    3. Add your field values in the list right under the last one listed – it should be $thumb. My field in the example below is $start_date.
        $thumb     = $thumbnail['thumb'];
        $start_date = get_field('start_date');
    
    1. Scroll down and find the place where you want to add your field within the article. (For example, I searched for ‘class="entry-title"’ in order to place my field below that.) Use some version of the following that works for the placement required.
    <?php if($start_date) { ?>
        <div class="start_date"><?php the_field('start_date'); ?></div>
    <?php } ?>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search