Viewing 14 replies - 1 through 14 (of 14 total)
  • You can hook to ai1ec_event_content. Check file lib/http/response/render/strategy/html.php

    // Pass the orginal content to the filter so that it can be modified
    return apply_filters(
    	'ai1ec_event_content',
    	$to_return,
    	$content
    );
    Thread Starter rodeored

    (@rodeored)

    How do i get the event content so I can pass it to the filter?

    $to_return is the markup we use for single event page. $content is the page/post content

    Thread Starter rodeored

    (@rodeored)

    Yes I know that, but I don’t know how to get the event content so I can use it in $content. Is there an example of this anywhere?

    What do you mean with “event content”? because $content is the “event content” for me as it is what you insert as the description of the event. The field marked with an arrow https://take.ms/lJboa

    Thread Starter rodeored

    (@rodeored)

    I think perhaps my problem is that I don’t know how to use the filter. Is there an example somewhere of how to use this filter?

    No, there are no examples AFAIK. Anyway we hook into ‘the_content’ but we hook pretty late. You could also modify our file, you will just have to do it every time you update

    Thread Starter rodeored

    (@rodeored)

    I’ll modify the file until I can figure out how to use apply_filters. Which file do I modify?

    Thread Starter rodeored

    (@rodeored)

    Inorder to pass the original content, I need to get the original content. How do I get the original content?

    // Pass the original content to the filter so that it can be modified
    return apply_filters(
    ‘ai1ec_event_content’,
    $to_return,
    $content
    );

    Thread Starter rodeored

    (@rodeored)

    $content=”WHAT GOES HERE?”
    // Pass the orginal content to the filter so that it can be modified
    return apply_filters(
    ‘ai1ec_event_content’,
    $to_return,
    $content
    );

    Hi, you must use apply_filters in your code and hook to that filter.

    function do_things_with_ai1ec( $to_return, $content ) {
      // do what you want
    }
    
    add_filter( 'ai1ec_event_content', 'do_things_with_ai1ec', 10, 2 );
    Thread Starter rodeored

    (@rodeored)

    I was able to get the filter working like so:
    function filter_calendar_content( $to_return, $content ) {
    $to_return=$content.=”Add this to the content”;
    return $to_return;
    }

    add_filter(‘ai1ec_event_content’,’filter_calendar_content’, 10, 2 );

    However, this filter only effects the calendar page for that event, which you can get to by clicking on “Read More”. It doesn’t have any effect on the content of each date in the calendar. How do I hook into the calendar dates? I

    strange, anyway sorry to have pointed you in the wrong direction..
    I’ll have to look at the codebase, you will probably have to wait until monday though

    Sorry for being late. I think you can use the filter ai1ec_the_content which just receive one parameter, the post content. We also call the standard the_content filter, so you can hook to that too.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Hook for event in calendar’ is closed to new replies.