Skip to content

Instantly share code, notes, and snippets.

@Geoplous
Last active January 9, 2024 09:09
Show Gist options
  • 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
@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