Andy Clements

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: Move `load_ecp_into_page_template` to a custom hook #1555301
    Andy Clements
    Participant

    I think I finally figured this out with the following code:

    // determine if the current page is a tribe page
    function is_tribe_page() {
        $queried_object = get_queried_object();
    
        $post_id = isset($post) ? $post->ID : (isset($queried_object->ID) ? $queried_object->ID : 0);
        $term_id = isset($queried_object->term_id) ? $queried_object->term_id : 0;
    
        if (function_exists("tribe_is_month") && tribe_is_month() && !is_tax()) {
        	return array(
                "archive"  => true,
                "view"     => "month",
                "taxonomy" => false,
                "term_id"  => 0,
            );
        } elseif (function_exists("tribe_is_month") && tribe_is_month() && is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "month",
                "taxonomy" => true,
                "term_id"  => $term_id,
            );
        } elseif (function_exists("tribe_is_past") && tribe_is_past() && !is_tax()) { // List View Page
            return array(
                "archive"  => true,
                "view"     => "list",
                "mode"     => "past",
                "taxonomy" => false,
                "term_id"  => 0,
            );
        } elseif (function_exists("tribe_is_upcoming") && tribe_is_upcoming() && !is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "list",
                "mode"     => "upcoming",
                "taxonomy" => false,
                "term_id"  => 0,
            );
        } elseif (function_exists("tribe_is_past") && tribe_is_past() && is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "list",
                "mode"     => "past",
                "taxonomy" => true,
                "term_id"  => $term_id,
            );
        } elseif (function_exists("tribe_is_upcoming") && tribe_is_upcoming() && is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "list",
                "mode"     => "upcoming",
                "taxonomy" => true,
                "term_id"  => $term_id,
            );
        } elseif (function_exists("tribe_is_week") && tribe_is_week() && !is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "week",
                "taxonomy" => false,
                "term_id"  => 0,
            );
        } elseif (function_exists("tribe_is_week") && tribe_is_week() && is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "week",
                "taxonomy" => true,
                "term_id"  => $term_id,
            );
        } elseif (function_exists("tribe_is_day") && tribe_is_day() && !is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "day",
                "taxonomy" => false,
                "term_id"  => 0,
            );
        } elseif (function_exists("tribe_is_day") && tribe_is_day() && is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "day",
                "taxonomy" => true,
                "term_id"  => $term_id,
            );
        } elseif (function_exists("tribe_is_map") && tribe_is_map() && !is_tax()) {
            return array(
                "archive"  => true,
                "view"     => "map",
                "taxonomy" => false,
                "term_id"  => 0,
            );
        } elseif (function_exists("tribe_is_map") && tribe_is_map() && is_tax()) { // Map View Category Page
            return array(
                "archive"  => true,
                "view"     => "map",
                "taxonomy" => true,
                "term_id"  => $term_id,
            );
        } elseif (function_exists("tribe_is_photo") && tribe_is_photo() && !is_tax()) { // Photo View Page
            return array(
                "archive"  => true,
                "view"     => "photo",
                "taxonomy" => false,
                "term_id"  => 0,
            );
        } elseif (function_exists("tribe_is_photo") && tribe_is_photo() && is_tax()) { // Photo View Category Page
            return array(
                "archive"  => true,
                "view"     => "photo",
                "taxonomy" => true,
                "term_id"  => $term_id,
            );
        } elseif (function_exists("tribe_is_event") && tribe_is_event() && is_single()) { // Single Events
            return array(
                "single"    => true,
                "post_type" => "tribe_events",
                "post_id"   => $post_id,
            );
        } elseif (function_exists("tribe_is_venue") && tribe_is_venue()) { // Single Venues
            return array(
                "single"    => true,
                "post_type" => "tribe_venue",
                "post_id"   => $post_id,
            );
        } elseif (get_post_type() === "tribe_organizer" && is_single()) { // Single Organizers
            return array(
                "single"    => true,
                "post_type" => "tribe_organizer",
                "post_id"   => $post_id,
            );
        } else {
            return false;
        }
    }
    
    // remove wpautop from tribe events pages
    function tribe_remove_content_filters() {
        if (is_tribe_page()) {
            remove_filter("the_content", "wpautop", 12);
            remove_filter("acf_the_content", "wpautop", 12);
        }
    }
    add_action("loop_start", "tribe_remove_content_filters", 999);
    in reply to: Move `load_ecp_into_page_template` to a custom hook #1550785
    Andy Clements
    Participant

    To be clear, the hook tribe_events_templates is a custom one that I want to add to my theme; the name can change if it needs to, that doesn’t particularly matter.

    Andy Clements
    Participant

    I just gave that a try; this doesn’t really solve the problem because I still want to apply my filters to the content output for each individual event, just not for all markup that’s output by Tribe Events.

    I guess it’s kind of hard to get across clearly what I mean, let me know if that doesn’t make sense.

    Andy Clements
    Participant

    I want to prevent Tribe Events from loading in via the_content() and instead manually load them myself. I believe this is the line of code that I need to disable, but I can’t figure out how:

    Tribe/Templates.php:292

    add_filter( 'the_content', array( __CLASS__, 'load_ecp_into_page_template' ) );

    in reply to: Can't dequeue style #1379261
    Andy Clements
    Participant

    Thanks so much, that did the trick 🙂

Viewing 5 posts - 1 through 5 (of 5 total)