Skip to content

Instantly share code, notes, and snippets.

@Geoplous
Last active January 9, 2024 09:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Geoplous/2bc48b319f57ebfc58e1752d2ccdb9be to your computer and use it in GitHub Desktop.
Save Geoplous/2bc48b319f57ebfc58e1752d2ccdb9be to your computer and use it in GitHub Desktop.
WordPress Divi show tags in Blog module
/* Create an override in your child theme.
/* Copy of the: Divi/includes/builder/module/Blog.php
/* to (create /module/ folder if does not exist): Divi-child/module/Blog.php
/* Edit the new Blog.php,
/* line3, replace: ET_Builder_Module_Blog with: Geoplous_ET_Builder_Module_Blog
/* last line, repace: new ET_Builder_Module_Blog; with new Geoplous_ET_Builder_Module_Blog;
/* Just before </article> (it will show the tags on the bottom of the post) add the code below:
<?php
printf( '<div class="myBlogTags">%1$s %2$s</div>',
// adding tags:
(
( ('on' === $show_author || 'on' === $show_date || 'on' === $show_categories || 'on' === $show_comments) && (get_the_tag_list() && ! is_wp_error(get_the_tag_list())) )
? ' '
: ''
),
(
( get_the_tag_list() && ! is_wp_error( get_the_tag_list() ) )
? '<span class="post-tags">' . get_the_tag_list( '', ', ' ) . '</span>'
: ''
)
);
?>
/* in funchtions.php add this:
/* // GeoPlous. Override the divi blog module
function blog_module_setup() {
get_template_part( 'module/Blog' );
remove_shortcode( 'et_pb_blog' );
add_shortcode( 'et_pb_blog', array( new Geoplous_ET_Builder_Module_Blog(), '_shortcode_callback' ) );
}
add_action( 'et_builder_ready', 'blog_module_setup' );
// E.O. GeoPlous. Override the divi blog module
@vikastyagi87
Copy link

You mentioned
to (create /module/ folder if does not exist): Divi-child/modules/Blog.php

i want to know folder name should modules or module bcoz you said create a folder module but in path metioned modules.

Thanks

@vikastyagi87
Copy link

vikastyagi87 commented Nov 1, 2019

I put my file here Divi-child/module/Blog.php after add tag code and do changes in functions.php but tags not showing with blog module.

@Geoplous
Copy link
Author

Geoplous commented Nov 1, 2019

it is ../module/.., code revised.
Sorry, but I can not see what is your issue

@vikastyagi87
Copy link

vikastyagi87 commented Nov 1, 2019

your code is worked, you just need to update remove first line from Blog.php file
require_once 'helpers/Overlay.php';
otherwise it give error.

Please remove comment functions.php file code sometimes we direct copy in functions.php via wp file manager, not sure code is comment or not so make it like that

//in funchtions.php add this:
//GeoPlous. Override the divi blog module
      function blog_module_setup() {
      get_template_part( 'module/Blog' ); 
      remove_shortcode( 'et_pb_blog' ); 
      add_shortcode( 'et_pb_blog', array( new Geoplous_ET_Builder_Module_Blog(), '_shortcode_callback' ) ); 
      }
      add_action( 'et_builder_ready', 'blog_module_setup' );
// E.O. GeoPlous. Override the divi blog module

Thanks

@selenii1
Copy link

selenii1 commented Jan 9, 2024

Is it work at that time? Is the Code shows the Tags in the Blog Module or in the current posts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment