• Resolved derbycat

    (@derbycat)


    How can I change the message that shows up in the widget when there are no events?

Viewing 4 replies - 1 through 4 (of 4 total)
  • baljitdhanjal

    (@baljitdhanjal)

    Hi @derbycat,

    In order to change message you have to make changes in plugin code.
    Remember whenever you will update the plugin your changes in plugin code will be lost.

    File path:- plugins\events-widgets-for-elementor-and-the-events-calendar\widgets\ectbe-widget.php

    In ectbe-widget.php file change “There is no Event” text at line no. 885

    $event_output .= '<h3>'.__("There is no Event","ectbe").'</h3>';

    Thanks

    Just a quick thought: Perhaps the plugin https://www.ads-software.com/plugins/say-what/ would do the trick? (At least if the string is marked for translation and the string is used in PHP…)
    (FYI @baljitdhanjal )

    Thread Starter derbycat

    (@derbycat)

    That change to the plugin code worked perfectly, thanks so much! Since I am hosted by Elementor cloud, I had to install filester to make the change.

    Thanks so much!

    Until string is marked for translation and to avoid fix being deleted once the plugin is updated, possible (but working solution) would be to use jQuery to search/replace text on page. I do know it is an overkill, but:

    1. Include .js to the footer of your child theme (or use Code Snippets if you are not into editing child theme or just looking for a faster approach)
    2a. Add code (for plain .js in the footer)

    	(function($) {
    		
    		$("h3").text(function () {
    		    return $(this).text().replace("There is no Event", "Your custom message here");			
    		});			
    		
    	})( jQuery );

    2b. or add code via Code Snippets

    add_action( 'wp_footer', function () { ?>
    <script>
    	(function($) {
    		
    		$("h3").text(function () {
    		    return $(this).text().replace("There is no Event", "Your custom message here");			
    		});			
    		
    	})( jQuery );
    	
    </script>
    <?php } );

    Things to consider:

    – .js must go to the footer in order to be executed (adding it to the header will not
    work)
    – you should wrap your Elementor widget into custom div ID and target it from .js code to make it faster

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change No Events Message’ is closed to new replies.