WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] em_content_pre and em_content are not working (10 posts)

  1. Miguel Peixe
    Member
    Posted 1 year ago #

    Hi,

    I'm trying to use em_content_pre filter to prevent the default template output but it's not working. It doesn't change the default output.

    Here's my test code:

    add_filter('em_content_pre', 'my_event_content');
    function my_event_content($content) {
     return 'test';
    }

    http://wordpress.org/extend/plugins/events-manager/

  2. Miguel Peixe
    Member
    Posted 1 year ago #

    Nevermind, I though em_content_pre would work with single event output. It filters the events main page.

    In case anyone wonders wich filter works on single event, it's em_event_output_single.

    Cheers

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    it used to work in v4, but in v5 they are custom posts so these now only apply to pages EM takes over when defined in the settings "Pages" tab.

  4. rudomilov
    Member
    Posted 1 year ago #

    Hi,

    I have "Display events as Pages" in EM settings, but
    add_filter('em_content','my_em_custom_content');
    makes no sense for event page. Sure, I wrote a "my_em_custom_content" function below.

    PS I have this in functions.php in my template.

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    Your code is missing, maybe try pastebin.com in case it's not coming through.

  6. rudomilov
    Member
    Posted 1 year ago #

    I solved this by:

    add_filter('em_event_output_placeholder','my_em_placeholder_mod',1,3);
    function my_em_placeholder_mod($replace, $EM_Event, $result){
    	if ( $result == '#_EVENTNOTES' ) {
    		$replace = "-before-".wpwiki($replace)."-after-";
    	}
    	return $replace;
    }

    I use it to parse a note text. Is it correct?

  7. agelonwl
    Member
    Posted 1 year ago #

    yes that seems to be correct;

  8. rudomilov
    Member
    Posted 1 year ago #

    How I can get an original #_EVENTNOTES, before converting to HTML (replacing \n to <br />and so on)?

    add_filter('em_event_output_placeholder','my_em_placeholder_mod',1,3);
    function my_em_placeholder_mod($replace, $EM_Event, $result){
    	if ( $result == '#_EVENTNOTES' ) {
    		$replace = "-before-".wpwiki($replace)."-after-";
    	}
    	return $replace;
    }

    Because there is a problem - I have already proceeded code in $replace. For example, I have actually:

    <p>* 1 place<br />
    * 2 place</p>

    But I need to have original string from DB:

    * 1 place
    * 2 place
  9. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    $EM_Event->post_content would be unfiltered.

  10. rudomilov
    Member
    Posted 1 year ago #

    It works! Thanks a lot!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic