noviembre 2020

Toolset: Different Custom Marker in a map based on a custom taxonomy

Solution: Add the following custom shortcode to determine how many terms are assigned to the current post in the loop:

function ts_get_post_tax_term_count_func( $atts ) {
  
  $a = shortcode_atts( array(
      'postid' => '0',
      'taxonomy' => null ), $atts
  );
  
  $terms = wp_get_post_terms( $a['postid'], $a['taxonomy']);
  return is_wp_error( $terms ) ? 0 : sizeof($terms);
}
  
add_shortcode( 'ts_get_post_tax_term_count', 'ts_get_post_tax_term_count_func');

Go to Toolset > Settings > Frontend content, and register both «has_term» and «ts_get_post_tax_term_count_func» to be used in conditionals and in 3rd party shortcode arguments. Then use the custom shortcode in combination with has_term to display the proper markers:

Multiple types:
[wpv-conditional if="('[ts_get_post_tax_term_count postid='[wpv-post-id]' taxonomy='facebook-type']' gt '1')"]https://www.tripup.it/wp-content/plugins/toolset-maps/resources/images/markers/MULTIPLE-MARKER.png[/wpv-conditional]
  
Only one type - arte-e-intrattenimento:
[wpv-conditional if="('[ts_get_post_tax_term_count postid='[wpv-post-id]' taxonomy='facebook-type']' eq '1') AND (has_term('arte-e-intrattenimento', 'facebook-type', null) eq '1')"]https://www.tripup.it/wp-content/uploads/2018/02/marker_shopping_web_white.png[/wpv-conditional]
  
Only one type - ospitelita:
[wpv-conditional if="('[ts_get_post_tax_term_count postid='[wpv-post-id]' taxonomy='facebook-type']' eq '1') AND (has_term('ospitelita', 'facebook-type', null) eq '1')"]https://www.tripup.it/wp-content/uploads/2018/02/OSPITELITA-MARKER.png[/wpv-conditional]
  
... copy and paste the block above for each facebook-type...
  
No types:
[wpv-conditional if="( [ts_get_post_tax_term_count postid='[wpv-post-id]' taxonomy='facebook-type']  eq '0')"]https://www.tripup.it/wp-content/plugins/toolset-maps/resources/images/markers/default.png[/wpv-conditional]

Visto en Toolset

Woocommerce i Bootstrap 4: Solucionar problema de desquadrament a woocommeca finalitzar comanda

/**
 * Don't enqueue Bootstrap on WC Products archive
 */
function dequeue_bootstrap(){

  if ( is_page( 'finalitza-la-compra' )) {


    // dequeue Bootstrap CSS
    function dequeue_bootstrap_css(){
      wp_dequeue_style( 'toolset_bootstrap_styles' );
      wp_dequeue_style( 'toolset_bootstrap_4' );
    }
    add_action( 'wp_print_styles', 'dequeue_bootstrap_css' );

    // dequeue Bootstrap JS 
    function dequeue_bootstrap_js(){
      wp_dequeue_script( 'toolset_bootstrap' );
      wp_dequeue_script( 'toolset_bootstrap_4' );
    }
    add_action( 'wp_print_scripts', 'dequeue_bootstrap_js' );    

  }

}
add_action( 'wp_enqueue_scripts', 'dequeue_bootstrap', 100 );

Vist a toolset: https://toolset.com/errata/bootstrap-4-columns-classes-col-1-and-col-2-conflicts-with-woocommerce/

You can follow this thread on WooCommerce GitHub page for a stable solution:

https://github.com/woocommerce/woocommerce/issues/15793

As a workaround, for now, you can de-queue Bootstrap on the checkout page using a custom code snippet like this one.

Of course, you’d have to change its condition to is_page( 'checkout' );.

Scroll al inicio

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.