Remove Text from Events+ Template?

On an event, I would like to remove the text that reads "Takes place on" or "Took place on". I want just the date/time to display, all by itself. Is that possible?

I would want this on single events, and also on archive lists of events.

  • Rupok
    • Support Ninja

    Hi kalico, hope you had a wonderful day.

    You can remove the "Takes place on" text by creating a MU Plugin. For creating a mu plugin, create a folder named "mu-plugins" inside your "wp-content" folder. Then inside that "mu-plugins" folder, create a file with any name and with a .php extension. Now paste the code inside that file and save.

    <?php
    add_action( 'wp_footer', 'hide_location_text' );
    function hide_location_text() {
        ?>
        <script type="text/javascript">
          jQuery(document).ready(function() {
    		jQuery('.wpmudevevents-date').each(function() {
    		    var text = jQuery(this).text();
    		    jQuery(this).text(text.replace('Takes place on', ''));
    		});
          });
        </script>
        <?php
    }

    For getting more idea on mu plugins, you can go through this article: http://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Please let us know if you have any confusion. We will be glad to help.

    Have a nice day. Cheers!
    Rupok

  • Rupok
    • Support Ninja

    Oh wait, actually the code I provided will replace only one sentence, but you need to replace multiple sentences. I do apologize. Can you please use the following code instead of the previous one I provided? It will work.

    <?php
    add_action( 'wp_footer', 'hide_location_text' );
    function hide_location_text() {
        ?>
        <script type="text/javascript">
    		jQuery('.wpmudevevents-date').each(function() {
    		    $(this).text($(this).text().replace(/Takes place on/g, ""));
    		    $(this).text($(this).text().replace(/Took place on/g, "Boy")); ;
    		});
        </script>
        <?php
    }

    Please let us know how it goes.

    Have a nice day. Cheers!
    Rupok

  • kalico
    • The Bug Hunter

    Hey Rupok :slight_smile: ... lol @ your coffee. Guess you need an extra shot in it. :wink:

    So I've reopened this ticket because the code you gave me worked....and then for no reason I can figure, it stopped working.

    I tested it immediately and it was great. But today, when I was poking around those pages, I realized that the words "takes places on/took place on" were back. I have no idea what might have caused it.

    Here's the code I've got in there:

    <?php
    
    // removes the text from Events archive lists and pages  //
    
    add_action( 'wp_footer', 'hide_location_text' );
    function hide_location_text() {
        ?>
        <script type="text/javascript">
                    jQuery('.wpmudevevents-date').each(function() {
                        $(this).text($(this).text().replace(/Takes place on/g, ""));
                        $(this).text($(this).text().replace(/Took place on/g, "")); ;
                    });
        </script>
        <?php
    }

    Here's the page that was working, and now is not: http://june.nrocnetwork.org/professional-development/upcoming-webinars/

    Any ideas?

  • kalico
    • The Bug Hunter

    Hey Rupok , Ash , and anyone else who find this....I'm going to mark this as resolved and continue the conversation in the other thread where Ash replied. There is still some wonky stuff going on with my site, but this code (and/or the one provided by Ash in the other thread) accomplished the goal I stated in this thread. So....THANK YOU :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.