Plugin Directory

Changeset 2682983


Ignore:
Timestamp:
02/22/2022 12:27:11 PM (4 years ago)
Author:
Ahaenor
Message:
  • V.3.24 - hotfix for Revo template display on Campaign single pages.
Location:
leyka
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • leyka/tags/3.24/templates/leyka-revo/leyka-revo-init.php

    r2682501 r2682983  
    55
    66// Revo campaigns have different elements order:
    7 if( !is_admin() && is_main_query() && is_singular(Leyka_Campaign_Management::$post_type) ) {
     7add_action('pre_get_posts', function(WP_Query $query){
    88
    9     remove_filter('the_content', 'leyka_print_donation_elements');
    10     if( !leyka_options()->opt_template('do_not_display_donation_form') ) {
    11         add_filter('the_content', 'leyka_revo_template_campaign_page');
     9    if( // Can't use $query->is_singular(Leyka_Campaign_Management::$post_type) here,
     10        // because there is no $query->get_queried_object_id() value at this point
     11        $query->is_main_query()
     12        && $query->is_singular()
     13        && $query->get('post_type') == Leyka_Campaign_Management::$post_type
     14        && $query->get('name')
     15    ) {
     16
     17        remove_filter('the_content', 'leyka_print_donation_elements');
     18
     19        if( !leyka_options()->opt_template('do_not_display_donation_form') ) {
     20            add_filter('the_content', 'leyka_revo_template_campaign_page');
     21        }
     22
    1223    }
    1324
    14 }
     25}, 11);
    1526
    1627function leyka_revo_template_campaign_page($content) {
  • leyka/trunk/templates/leyka-revo/leyka-revo-init.php

    r2619511 r2682983  
    55
    66// Revo campaigns have different elements order:
    7 if( !is_admin() && is_main_query() && is_singular(Leyka_Campaign_Management::$post_type) ) {
     7add_action('pre_get_posts', function(WP_Query $query){
    88
    9     remove_filter('the_content', 'leyka_print_donation_elements');
    10     if( !leyka_options()->opt_template('do_not_display_donation_form') ) {
    11         add_filter('the_content', 'leyka_revo_template_campaign_page');
     9    if( // Can't use $query->is_singular(Leyka_Campaign_Management::$post_type) here,
     10        // because there is no $query->get_queried_object_id() value at this point
     11        $query->is_main_query()
     12        && $query->is_singular()
     13        && $query->get('post_type') == Leyka_Campaign_Management::$post_type
     14        && $query->get('name')
     15    ) {
     16
     17        remove_filter('the_content', 'leyka_print_donation_elements');
     18
     19        if( !leyka_options()->opt_template('do_not_display_donation_form') ) {
     20            add_filter('the_content', 'leyka_revo_template_campaign_page');
     21        }
     22
    1223    }
    1324
    14 }
     25}, 11);
    1526
    1627function leyka_revo_template_campaign_page($content) {
Note: See TracChangeset for help on using the changeset viewer.