@mlg4035 Thank you very much!
[Solved] EduMall theme does not show Smart Excerpts and broken the search results page
-
The famous and beautiful EduMall theme for WordPress has a little incompatibility with the WPFTS's Smart Excerpt. The reason for this is simple - the authors of this theme use their own way of shortening article text to generate excerpts and do not offer a workaround method within the code using hooks.
Well, we'll have to use a tougher method to fix this incompatibility than simply installing an addon (as we do in most other cases).
So, first of all, we have to switch to the child theme EduMall Child Theme. Technically, we could make fixes in the main theme as well, but in this case any update of the theme would result in the loss of all changes, and we don't need that.
So, go to the child theme folder, edumall-child, and create a subfolder tree there:
template-parts/blog/loop/
Then go to the same folder in the main theme, find files
excerpt.php
andexcerpt-long.php
and copy only these two files to the new created folder in the child theme.Now we need to "patch" both files.
Open the first file,
excerpt.php
, find two calls of the methodEdumall_Templates::excerpt
and comment it out with parameters, using /* */ operator.Then add this line below the "*/":
the_excerpt();
Do this in both places in this file.
When done, move to the second file
excerpt-long.php
and do exactly the same in it, patch in two places.Finally your files should look like this:
excerpt.php
:<?php /** * The template for displaying loop excerpt. * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post * * @package Edumall * @since 1.0 */ defined( 'ABSPATH' ) || exit; $post_title = get_the_title(); ?> <div class="post-excerpt"> <?php if ( empty( $post_title ) ) : ?> <a href="<?php the_permalink(); ?>"> <?php /*Edumall_Templates::excerpt( array( 'limit' => 11, 'type' => 'word', ) );*/ the_excerpt(); ?> </a> <?php else: ?> <?php /*Edumall_Templates::excerpt( array( 'limit' => 11, 'type' => 'word', ) );*/ the_excerpt(); ?> <?php endif; ?> </div>
and
excerpt-long.php
:<?php /** * The template for displaying loop excerpt. * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post * * @package Edumall * @since 1.0 */ defined( 'ABSPATH' ) || exit; $post_title = get_the_title(); ?> <div class="post-excerpt"> <?php if ( empty( $post_title ) ) : ?> <a href="<?php the_permalink(); ?>"> <?php /*Edumall_Templates::excerpt( array( 'limit' => 42, 'type' => 'word', ) );*/ the_excerpt(); ?> </a> <?php else: ?> <?php /*Edumall_Templates::excerpt( array( 'limit' => 42, 'type' => 'word', ) );*/ the_excerpt(); ?> <?php endif; ?> </div>
All Done.
After this, the useful Smart Excerpt of WPFTS should be visible on the Search Results pages.
If it does not work - please let us know!