Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter artomi

    (@artomi)

    What about Checkout API. Is it possible to change it by that way?

    https://developers.klarna.com/api/#checkout-api-callbacks-address-update

    • This reply was modified 3 years, 4 months ago by artomi.
    Thread Starter artomi

    (@artomi)

    The Template lazyblock-as-nayta-palvelut.php

    <?php
    $args = array(
        'post_type' => 'as_palvelut',
        'posts_per_page' => -1,
        'orderby' => 'title',
        'order' => 'ASC',
    
    );
    
    // Query the posts:
    $the_query = new WP_Query($args);
    
    // Get taxonomy list of paikat
    $terms_paikat = get_terms( array(
        'taxonomy' => 'as_paikat',
        'orderby' => 'name',
        'order' => 'ASC',
        'hide_empty' => true
      ) );
    
      $terms_teemat = get_terms( array(
          'taxonomy' => 'as_teemat',
          'orderby' => 'name',
          'order' => 'ASC',
          'hide_empty' => true
        ) );
    
    echo'<div class="as-filter-btns">';
    
    if ($attributes['show-places-buttons']){
    ?>
      <h3 class="as-filter-title">Paikat:</h3>
      <div class="as-filter-btns-wrap">
        <ul class="as-filter-list">
          <li class="as-filter-btn as-toggled" filter="all"><?php __('Kaikki','astra')?>Kaikki</li>
          <?php
            foreach ($terms_paikat as $paikka){
              echo'<li class="as-filter-btn" style="background-image:url('.wp_get_attachment_image_src($teema->ID,'thumbnail').')" filter="'.$paikka->slug.'">'.$paikka->name.'</li>';
            }
           ?>
        </ul>
      </div>
    <?php }
    if ($attributes['show-themes-buttons']){
    ?>
      <h3 class="as-filter-title">Teemat:</h3>
      <div class="as-filter-btns-wrap">
        <ul class="as-filter-list">
          <li class="as-filter-btn as-toggled" filter="all"><?php __('Kaikki','astra')?>Kaikki</li>
          <?php
            foreach ($terms_teemat as $teema){
    
              echo'<li class="as-filter-btn" filter="'.$teema->slug.'">'.$teema->name.'</li>';
            }
           ?>
        </ul>
      </div>
    <?php
    }
    echo'</div>';
    
    echo '<div class="as-grid">';
    // Loop through the palvelut:
    while ($the_query->have_posts()) :
        $the_query->the_post();
        $cat=" ";
        $title="";
    
        // Hae kategoriat
        $terms = get_the_terms( $post->ID, array('as_paikat', 'as_teemat') );
    
        if($terms):
          foreach ( $terms as $term ) {
              $cat .= "as-cat-".$term->slug." ";
              $title .= $term->name." ";
          }
        endif;
    
        if("000-OLETUSPOHJA" != get_the_title() ):
          if( "" == get_post_meta( get_the_ID(), 'as-piilota',true ) ):
    
            echo '<div class="as-grid-item as-grid-col-'.$attributes['columns'].$cat.'" as-title="'.$title.'">';
    
            // Within the loop, you can access custom fields like so:
            echo '<a href="'.get_permalink().'" class="as-link">';
            echo '<div class="as-image-thumbnail" style="background-image:url('.get_the_post_thumbnail_url(get_the_ID(),'medium_large').')"></div>';
            echo'<div class="as-info">';
            echo'<div class="as-title">';
              if($attributes['show-title']) echo '<h3 style="color:'.$attributes['title-color'].'">'.get_the_title().'</h3>';
              if($attributes['show-excerpt']) echo '<p class="as-excerpt">'.get_the_excerpt().'</p>';
            echo'</div>';
            
            if($attributes['show-price']) echo '<p class="as-price">'.get_lzb_meta('as-hinta').'</p>';
            if($attributes['show-duration']) echo '<p class="as-duration">'.get_lzb_meta('as-kesto').'</p>';
            if($attributes['show-group-size']) echo '<p class="as-group-size">'.get_lzb_meta('as-ryhmakoko').'</p>';
            //echo '<p style="font-size:8px;">Hidden='.((get_lzb_meta('as-piilota')) ? "true":"false").'</p>';
            //$vd = var_dump(get_post_meta( get_the_ID(), 'as-piilota',true ));
            //echo '<p style="font-size:8px;">Hidden='.$vd.'</p>';
    
            echo '</div>';
            echo '</a>';
    
            echo '</div>';
          endif;
        endif;
    endwhile;
    echo '</div>';
    // Reset Post Data
    wp_reset_postdata();
    
    ?>
    

    Block Json code:

    [
        {
            "id": 196,
            "title": "AS N?yt? palvelut",
            "icon": "<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z\" \/><\/svg>",
            "keywords": [],
            "slug": "lazyblock\/as-nayta-palvelut",
            "description": "N?yt? Palvelut sivulla",
            "category": "services",
            "category_label": "Services",
            "supports": {
                "customClassName": true,
                "anchor": false,
                "align": [
                    "wide",
                    "full"
                ],
                "html": false,
                "multiple": true,
                "inserter": true
            },
            "ghostkit": {
                "supports": {
                    "spacings": false,
                    "display": false,
                    "scrollReveal": false,
                    "frame": false,
                    "customCSS": false
                }
            },
            "controls": {
                "control_3e98904b36": {
                    "type": "select",
                    "name": "type",
                    "default": "grid",
                    "label": "Type",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "choices": [
                        {
                            "label": "Grid (default)",
                            "value": "grid"
                        }
                    ],
                    "allow_null": "false",
                    "multiple": "false",
                    "output_format": "",
                    "placeholder": "",
                    "characters_limit": ""
                },
                "control_d2b9a54a14": {
                    "type": "number",
                    "name": "columns",
                    "default": "4",
                    "label": "Columns",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "min": "1",
                    "max": "6",
                    "step": "1",
                    "placeholder": "",
                    "characters_limit": ""
                },
                "control_0e583a4bf8": {
                    "type": "checkbox",
                    "name": "show-places-buttons",
                    "default": "",
                    "label": "Show Places buttons",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "checked": "true",
                    "alongside_text": "",
                    "placeholder": "",
                    "characters_limit": "",
                    "multiple": "false",
                    "allow_null": "false"
                },
                "control_70594d433f": {
                    "type": "checkbox",
                    "name": "show-themes-buttons",
                    "default": "",
                    "label": "Show Themes buttons",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "checked": "true",
                    "alongside_text": "",
                    "placeholder": "",
                    "characters_limit": "",
                    "multiple": "false",
                    "allow_null": "false"
                },
                "control_b5a88b43d3": {
                    "type": "checkbox",
                    "name": "show-title",
                    "default": "",
                    "label": "show title",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "checked": "true",
                    "alongside_text": "",
                    "placeholder": "",
                    "characters_limit": "",
                    "multiple": "false",
                    "choices": []
                },
                "control_510aad4426": {
                    "type": "checkbox",
                    "name": "show-excerpt",
                    "default": "",
                    "label": "show excerpt",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "true",
                    "save_in_meta_name": "show-excerpt",
                    "required": "false",
                    "checked": "true",
                    "alongside_text": "",
                    "placeholder": "",
                    "characters_limit": "",
                    "multiple": "false",
                    "choices": []
                },
                "control_4698df466a": {
                    "type": "checkbox",
                    "name": "show-price",
                    "default": "",
                    "label": "show price",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "checked": "true",
                    "alongside_text": "",
                    "placeholder": "",
                    "characters_limit": "",
                    "multiple": "false",
                    "choices": []
                },
                "control_e67ba34215": {
                    "type": "checkbox",
                    "name": "show-duration",
                    "default": "",
                    "label": "show duration",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "checked": "true",
                    "alongside_text": "",
                    "placeholder": "",
                    "characters_limit": "",
                    "multiple": "false",
                    "choices": []
                },
                "control_2fe8ff4f00": {
                    "type": "checkbox",
                    "name": "show-group-size",
                    "default": "",
                    "label": "show group size",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "checked": "true",
                    "alongside_text": "",
                    "placeholder": "",
                    "characters_limit": "",
                    "multiple": "false",
                    "choices": []
                },
                "control_d1491849a0": {
                    "type": "color",
                    "name": "title-color",
                    "default": "#ffffff",
                    "label": "Title color",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "alpha": "true",
                    "placeholder": "",
                    "characters_limit": ""
                },
                "control_331ae64474": {
                    "type": "select",
                    "name": "show-categories",
                    "default": "",
                    "label": "Show categories",
                    "help": "",
                    "child_of": "",
                    "placement": "inspector",
                    "width": "100",
                    "hide_if_not_selected": "false",
                    "save_in_meta": "false",
                    "save_in_meta_name": "",
                    "required": "false",
                    "choices": [
                        {
                            "label": "Option1",
                            "value": "o1"
                        },
                        {
                            "label": "Option2",
                            "value": "o2"
                        }
                    ],
                    "allow_null": "false",
                    "multiple": "true",
                    "output_format": "",
                    "placeholder": "",
                    "characters_limit": ""
                }
            },
            "code": {
                "output_method": "template",
                "editor_html": "",
                "editor_callback": "",
                "editor_css": "",
                "frontend_html": "<?php \n$args = array(\n    'post_type' => 'palvelut',\n    'posts_per_page' => 999,\n    'orderby' => 'title',\n    'order' => 'ASC',\n    \n);\n\n\/\/ Query the posts:\n$the_query = new WP_Query($args);\necho '<div class=\"as-grid\">';\n\/\/ Loop through the palvelut:\nwhile ($the_query->have_posts()) : $the_query->the_post();\n    $cat=\" \";\n    $title=\"\";\n    \n    \/\/ Hae kategoriat\n    $terms = get_the_terms( $post->ID,[ 'taxonomy' => 'paikat' ] );\n    foreach ( $terms as $term ) {\n        $cat .= \"as-cat-\".$term->slug.\" \";\n        $title .= $term->name.\" \";\n    }\n    \n    echo '<div class=\"as-grid-item as-grid-col-'.$attributes['columns'].$cat.'\" as-title=\"'.$title.'\">';\n    \n    \/\/ Within the loop, you can access custom fields like so:\n    echo '<a href=\"'.get_permalink().'\" class=\"as-link\">';    \n    echo '<img class=\"as-image-thumbnail\" style=\"background-image:url('.get_the_post_thumbnail_url(get_the_ID(),'medium_large').')\">';\n    echo'<div class=\"as-info\">';\n    if($attributes['show-title']) echo '<h3 class=\"as-title\" style=\"color:'.$attributes['title-color'].'\">'.get_the_title().'<\/h3>';\n    if($attributes['show-price']) echo '<p class=\"as-price\">'.get_lzb_meta('as-hinta').'<\/p>';\n    if($attributes['show-duration']) echo '<p class=\"as-duration\">'.get_lzb_meta('as-kesto').'<\/p>';\n    if($attributes['show-group-size']) echo '<p class=\"as-group-size\">'.get_lzb_meta('as-ryhmakoko').'<\/p>';\n    \n    echo'<\/div>';\n    echo'<\/a>';\n    echo '<\/div>';\nendwhile;\necho '<\/div>';\n\/\/ Reset Post Data\nwp_reset_postdata();\n\n?>",
                "frontend_callback": "",
                "frontend_css": "",
                "show_preview": "always",
                "single_output": true
            },
            "condition": []
        }
    ]
    Thread Starter artomi

    (@artomi)

    I got it work with
    get_post_meta(get_the_ID(),"my-key", true)

    But somehow get_lzb_meta() don’t work?! There is no duplicates in DB.

    Thread Starter artomi

    (@artomi)

    Hi Carsten.
    It works now. Just update your lazy blocks-plugin.

Viewing 4 replies - 1 through 4 (of 4 total)