Forum Replies Created

Viewing 15 replies - 46 through 60 (of 703 total)
  • Thread Starter Phil

    (@owendevelopment)

    So my setup is a little custom.

    Using tribe Events Tickets Plus plugin.

    This allows creation of tickets on any WP page or post (I’m using a custom post type).

    When you create tickets, they create separate Woocommerce products. I have added the PPOM fields onto those products.

    On the front-end, the page with tickets aggregates them onto one page, but they are still separate products to Woocommerce.

    I’m finding as seen in my first post, that the datepicker for the date field is only saving the last date used when multiple tickets with dofferent dates are selected. I assume it’s a javascript issue being saved to the input – rather than having different unique classes to save data against. Maybe product ID would be a good one for a unique ID perhaps?

    Forum: Plugins
    In reply to: [Helpful] Small text bug
    Thread Starter Phil

    (@owendevelopment)

    It does, but it seems to cut a character off the end of the word.

    How it’s set: https://imgur.com/IoCbNKl

    How it displays: https://imgur.com/AOS23Os

    Phil

    (@owendevelopment)

    Can confirm this has stopped working on all my clients sites using the Honeypot plugin. They are receiving Russian spam even with a renamed honeypot field.

    Thread Starter Phil

    (@owendevelopment)

    The one that was working before (that now won’t re-upload/save) is a .png, 384 × 68px, 5kb.

    Thread Starter Phil

    (@owendevelopment)

    <3

    So it came down to it requiring this line:

    $formatted_meta = $class->get_formatted( '_' );

    Thanks dude, much appreciated.

    Thread Starter Phil

    (@owendevelopment)

    Nope, this is literally the entire thing:

    // define the woocommerce_order_items_meta_display callback
    function filter_wps_order_items_meta_display( $output, $this, $formatted_meta ) {
      $meta_list = array();
      foreach ( $formatted_meta as $meta ) {
              $meta_list[] = '<dd class="variation">' . wp_kses_post( wpautop( make_clickable( $meta['value'] ) ) ) . '</dd>';
          }
    
          $output = '<dl class="variation">' . implode( '', $meta_list ) . '</dl>';
    
          return $output;
    
    };
    // add the filter
    add_filter( 'woocommerce_order_items_meta_display', 'filter_wps_order_items_meta_display', 10, 3 );
    Thread Starter Phil

    (@owendevelopment)

    Hi,

    Still just outputs empty:

    <dl class="variation"></dl>
    <dl class="variation"></dl>

    Seems to be outputting the <dl> as foreach, rather than it being the container and inner <dd>’s, which should be the foreach loop, no?

    Thread Starter Phil

    (@owendevelopment)

    Hi Mike,

    It just outputs it empty:

    <dl class="variation"></dl>
    <dl class="variation"></dl>

    So the filter works, it’s just not outputting the meta values. Here’s the filter:

    // define the woocommerce_order_items_meta_display callback
    function filter_wps_order_items_meta_display( $output, $this, $formatted_meta ) { 
    
      foreach ( $formatted_meta as $meta ) {
              $meta_list[] = '
                <dd class="variation">' . wp_kses_post( wpautop( make_clickable( $meta['value'] ) ) ) . '</dd>
              ';
          }
    
          $output = '<dl class="variation">' . implode( '', $meta_list ) . '</dl>';
    
          return $output;
    
    };
    // add the filter
    add_filter( 'woocommerce_order_items_meta_display', 'filter_wps_order_items_meta_display', 10, 2 );
    Thread Starter Phil

    (@owendevelopment)

    Just can’t get this working. It either adds the new ones in addition to the existing or just doesn’t display at all.

    // define the woocommerce_order_items_meta_display callback
    function filter_wps_order_items_meta_display( $output, $this, $formatted_meta ) { 
    
      foreach ( $formatted_meta as $meta ) {
              $meta_list[] = '
                <dd class="variation">' . wp_kses_post( wpautop( make_clickable( $meta['value'] ) ) ) . '</dd>
              ';
          }
    
          $output .= '<dl class="variation">' . implode( '', $meta_list ) . '</dl>';
    
          return $output;
    
    };
    // add the filter
    add_filter( 'woocommerce_order_items_meta_display', 'filter_wps_order_items_meta_display', 10, 2 );

    Am I missing something here?

    Thread Starter Phil

    (@owendevelopment)

    Ignore, I got it working.

    Thread Starter Phil

    (@owendevelopment)

    // define the woocommerce_order_items_meta_display callback
        function filter_wps_order_items_meta_display( $output, $instance ) { 
    
              $instance = '
                <dt class="variationz-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( $meta['label'] ) . ':</dt>
                <dd class="variationz-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( wpautop( make_clickable( $meta['value'] ) ) ) . '</dd>
              ';
    
              $output .= '<dl class="variation">' . implode( '', $instance ) . '</dl>';
    
          return $output;
    
        };
        // add the filter
    Thread Starter Phil

    (@owendevelopment)

    Ok, I’ve figured out the hook:

    function filter_wps_order_items_meta_display( $output, $this ) {
          return $output;
        };
    add_filter( 'woocommerce_order_items_meta_display', 'filter_wps_order_items_meta_display', 10, 2 );

    which I can see works, but how do I strip the HTML tags off this?

    $meta_list[] = '<dt class="variation-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( $meta['label'] ) . ':</dt>
    						<dd class="variation-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( wpautop( make_clickable( $meta['value'] ) ) ) . '</dd>
    					';

    I’ve tried numerous ways of doing this trying to add a modified $meta_list array but it just seems to add it to the end of the default output rather than replacing it.

    Thread Starter Phil

    (@owendevelopment)

    Ok, I’ve adapted to this but it still isn’t working.

    function wps_order_items_meta_display($meta_list) {
              $meta_list[] = '
                <dt class="variation-test-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( $meta['label'] ) . ':</dt>
                <dd class="variation-test-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( wpautop( make_clickable( $meta['value'] ) ) ) . '</dd>
              ';
    
      return $meta_list;
    }
    add_filter('woocommerce_order_items_meta_display', 'wps_order_items_meta_display');

    Do I need to deregister the original filter?

    Thread Starter Phil

    (@owendevelopment)

    Like this?

    add_filter('woocommerce_order_items_meta_display', 'wps_order_items_meta_display');
    function wps_order_items_meta_display( $flat = false, $return = false, $hideprefix = '_', $delimiter = ", \n" ) {
        $output         = '';
        $formatted_meta = $this->get_formatted( $hideprefix );
    
        if ( ! empty( $formatted_meta ) ) {
          $meta_list = array();
    
          foreach ( $formatted_meta as $meta ) {
            if ( $flat ) {
              $meta_list[] = wp_kses_post( $meta['label'] . ': ' . $meta['value'] );
            } else {
              $meta_list[] = '
                <dt class="variationz-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( $meta['label'] ) . ':</dt>
                <dd class="variationz-' . sanitize_html_class( sanitize_text_field( $meta['key'] ) ) . '">' . wp_kses_post( wpautop( make_clickable( $meta['value'] ) ) ) . '</dd>
              ';
            }
          }
    
          if ( ! empty( $meta_list ) ) {
            if ( $flat ) {
              $output .= implode( $delimiter, $meta_list );
            } else {
              $output .= '<dl class="variationz">' . implode( '', $meta_list ) . '</dl>';
            }
          }
        }
    
        $output = apply_filters( 'woocommerce_order_items_meta_display', $output, $this );
    
        if ( $return ) {
          return $output;
        } else {
          echo $output;
        }
    }

    Phil

    (@owendevelopment)

    Maybe try posting this in the plugins support thread.
    https://wordpress.org/support/plugin/hookpress

Viewing 15 replies - 46 through 60 (of 703 total)