Forum Replies Created

Viewing 15 replies - 1 through 15 (of 19 total)
  • Thread Starter mateusvitor

    (@mateusvitor)

    Hi Anders, hadn’t seen your reply yet, but thank you for the quick response!

    Thread Starter mateusvitor

    (@mateusvitor)

    Ok I solved it.

    
    function own_add_cpt_to_allowed_post_types_for_meta_output( $arr ) {
      if( !is_array( $arr ))
        $arr = array( $arr );
      array_push( $arr, 'custom_post_type_slug' );
      return $arr;
    }
    add_filter( 'koji_allowed_post_types_for_meta_output', 'own_add_cpt_to_allowed_post_types_for_meta_output', 10, 3 );
    
    Thread Starter mateusvitor

    (@mateusvitor)

    I think the issue might be that it is a custom post type.
    I found this on the theme’s functions.php.

    
    // Check that the post type should be able to output post meta
     $allowed_post_types = apply_filters( 'koji_allowed_post_types_for_meta_output', array( 'post' ) );
     if ( ! in_array( get_post_type( $post_id ), $allowed_post_types ) ) {
       return;
     }
    
    • This reply was modified 4 years, 7 months ago by mateusvitor.
    Thread Starter mateusvitor

    (@mateusvitor)

    They are showing and change according to my customization options, in the related posts section of each post.

    Thread Starter mateusvitor

    (@mateusvitor)

    Thanks! I will keep this note for when I need it. It is indeed not a that much a priority right now.
    Cheers!

    Thread Starter mateusvitor

    (@mateusvitor)

    Thank you for your quick response.
    Add New: I figured.
    Right now I could very well survive without it, and I will test it, but I foresee to need it soon. I count on wanting to separate who edits products, and who edits the blog posts.

    • This reply was modified 4 years, 10 months ago by mateusvitor.
    Thread Starter mateusvitor

    (@mateusvitor)

    also the proper slugs are ‘produtos’ and ‘opcoes_decorativas’ as you will find.

    Thread Starter mateusvitor

    (@mateusvitor)

    Ok, I had removed the show_in_menu option as a temporary fix. Here’s the whole blob, with the option active. TIA
    {"produtos":{"name":"produtos","label":"Produtos","singular_label":"Produto","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"true","has_archive_string":"","exclude_from_search":"false","capability_type":"produtos","hierarchical":"true","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"","menu_icon":"dashicons-screenoptions","supports":["title","editor","thumbnail","custom-fields","page-attributes"],"taxonomies":["aplicacoes","caracteristicas"],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":"","name_admin_bar":"","item_published":"","item_published_privately":"","item_reverted_to_draft":"","item_scheduled":"","item_updated":""},"custom_supports":""},"opcoes_decorativas":{"name":"opcoes_decorativas","label":"Op\u00e7\u00f5es Decorativas","singular_label":"Op\u00e7\u00e3o Decorativa","description":"","public":"true","publicly_queryable":"true","show_ui":"true","show_in_nav_menus":"true","delete_with_user":"false","show_in_rest":"true","rest_base":"","rest_controller_class":"","has_archive":"false","has_archive_string":"","exclude_from_search":"false","capability_type":"produtos","hierarchical":"false","rewrite":"true","rewrite_slug":"","rewrite_withfront":"true","query_var":"true","query_var_slug":"","menu_position":"","show_in_menu":"true","show_in_menu_string":"edit.php?post_type=produtos","menu_icon":"dashicons-art","supports":["title","custom-fields"],"taxonomies":[],"labels":{"menu_name":"","all_items":"","add_new":"","add_new_item":"","edit_item":"","new_item":"","view_item":"","view_items":"","search_items":"","not_found":"","not_found_in_trash":"","parent_item_colon":"","featured_image":"","set_featured_image":"","remove_featured_image":"","use_featured_image":"","archives":"","insert_into_item":"","uploaded_to_this_item":"","filter_items_list":"","items_list_navigation":"","items_list":"","attributes":"","name_admin_bar":"","item_published":"","item_published_privately":"","item_reverted_to_draft":"","item_scheduled":"","item_updated":""},"custom_supports":""}}

    • This reply was modified 4 years, 10 months ago by mateusvitor.
    Thread Starter mateusvitor

    (@mateusvitor)

    I took the liberty of removing the labels.

    {
        "produtos":
        {
            "name": "produtos",
            "label": "Produtos",
            "singular_label": "Produto",
            "description": "",
            "public": "true",
            "publicly_queryable": "true",
            "show_ui": "true",
            "show_in_nav_menus": "true",
            "delete_with_user": "false",
            "show_in_rest": "true",
            "rest_base": "",
            "rest_controller_class": "",
            "has_archive": "true",
            "has_archive_string": "",
            "exclude_from_search": "false",
            "capability_type": "produtos",
            "hierarchical": "true",
            "rewrite": "true",
            "rewrite_slug": "",
            "rewrite_withfront": "true",
            "query_var": "true",
            "query_var_slug": "",
            "menu_position": "",
            "show_in_menu": "true",
            "show_in_menu_string": "",
            "menu_icon": "dashicons-screenoptions",
            "supports": ["title", "editor", "thumbnail", "custom-fields", "page-attributes"],
            "taxonomies": ["aplicacoes", "caracteristicas"],
            "custom_supports": ""
        },
        "colors":
        {
            "name": "colors",
            "label": "Colors",
            "singular_label": "Color",
            "description": "",
            "public": "true",
            "publicly_queryable": "true",
            "show_ui": "true",
            "show_in_nav_menus": "true",
            "delete_with_user": "false",
            "show_in_rest": "true",
            "rest_base": "",
            "rest_controller_class": "",
            "has_archive": "false",
            "has_archive_string": "",
            "exclude_from_search": "false",
            "capability_type": "produtos",
            "hierarchical": "false",
            "rewrite": "true",
            "rewrite_slug": "",
            "rewrite_withfront": "true",
            "query_var": "true",
            "query_var_slug": "",
            "menu_position": "",
            "show_in_menu": "true",
            "show_in_menu_string": "",
            "menu_icon": "dashicons-art",
            "supports": ["title", "custom-fields"],
            "taxonomies": [],
            "custom_supports": ""
        }
    }
    Thread Starter mateusvitor

    (@mateusvitor)

    You’re right. Thank you very much.

    Thread Starter mateusvitor

    (@mateusvitor)

    I made my own counter in the meantime. I know the difference between server time and user/client time. I wanted to show not just the countdown timer, but also the timedate. The counter is independent of timezone because its a duration. But the time no. Sorry for not putting the question any clear at all, I was very stressed in that week.

    Thread Starter mateusvitor

    (@mateusvitor)

    Thank you, it really helped.
    I completely override the $meta[‘regions’], because I know there is nothing there of value in my case. I echoed all the stuff just to see what was there. I copied the list of countries in the map settings page, pasted in a sheet, sorted, re-concactenated the countries’ shortcode with their names as PT : Portugal, so it fits the advanced custom field(acf) select options, and it was all smooth sailing. Just had to re-associate the countries in each user for the acf because it was returning the old values so label and value were coming out the same.
    Sharing this in case someone else needs.
    Cheers!

    
    function vmg_igm_meta( $meta ) {
      /*
      // get option values.
        $opts      = get_option( 'interactive-maps' );
        $tax       = isset( $opts['igmc_taxonomy'] )       ? $opts['igmc_taxonomy'] : '';
        $metaf     = isset( $opts['igmc_meta'] )           ? $opts['igmc_meta'] : '';
        $acf       = isset( $opts['igmc_meta_is_acf'] )    ? $opts['igmc_meta_is_acf'] : false;
        $action    = isset( $opts['igmc_action_content'] ) ? $opts['igmc_action_content'] : 'open_url';
        $empty     = isset( $opts['igmc_hide_empty'] )     ? $opts['igmc_hide_empty'] : false;
        $cache     = isset( $opts['igmc_cache'] )          ? $opts['igmc_cache'] : false;
        $post_type = isset( $opts['igmc_cpt'] )            ? $opts['igmc_cpt'] : 'any';
        $regions   = isset( $meta['regions'] )             ? $meta['regions'] : [];
    
        //$regions = isset( $meta['regions'] ) && is_array( $meta['regions'] ) ? $meta['regions'] : [];
      echo '<div style="display:none">';
        echo '<h5 class="d-none">$opts </h5>';
        echo '<pre class="d-none">';
        var_dump($opts);
        echo ' </pre>';
        //
        echo '<h5 class="d-none">$tax</h5>';
        echo '<pre class="d-none">';
        var_dump($tax);
        echo ' </pre>';
        //
        echo '<h5 class="d-none">$metaf</h5>';
        echo '<pre class="d-none">';
        var_dump($metaf);
        echo ' </pre>';
        //
        echo '<h5 class="d-none">$acf</h5>';
        echo '<pre class="d-none">';
        var_dump($acf);
        echo ' </pre>';
        //
        echo '<h5 class="d-none">$action</h5>';
        echo '<pre class="d-none">';
        var_dump($action);
        echo ' </pre>';
        //
        echo '<h5 class="d-none">$empty</h5>';
        echo '<pre class="d-none">';
        var_dump($empty);
        echo ' </pre>';
        //
        echo '<h5 class="d-none">$cache</h5>';
        echo '<pre class="d-none">';
        var_dump($cache);
        echo ' </pre>';
        //
        echo '<h5 class="d-none">$post_type</h5>';
        echo '<pre class="d-none">';
        var_dump($post_type);
        echo ' </pre>';
        //
        echo '<h5 class="d-none">$regions</h5>';
        echo '<pre class="d-none">';
        var_dump($regions);
        echo ' </pre>';
      echo '</div>';
      */
      /*
      array(1) {
        [0]=>
        array(5) {
          ["name"]=>
          string(8) "Portugal"
          ["id"]=>
          string(2) "PT"
          ["tooltipContent"]=>
          string(17) "Portugal is nice."
          ["content"]=>
          string(0) ""
          ["useDefaults"]=>
          string(1) "1"
        }
      }
     */
    
      $all_users = get_users();
      $participant_countries_array_by_key = array();
      $participant_countries_array = array();
      if(!empty($all_users)):
        foreach ($all_users as $user) :
          $u_uID = 'user_'.$user -> ID;
          if(get_field('is_a_participant', $u_uID)):
            $participant_country = get_field('country', $u_uID); // [ 'value', 'label' ]
            echo '<h5 class="d-none">$participant_country </h5>';
            echo '<pre class="d-none">';
            var_dump($participant_country);
            echo ' </pre>';
    
            $p_first_name = $user -> user_firstname;
            $p_last_name = $user -> user_lastname;
            $p_append = get_field('user_append', $u_uID);
            $participant_proper_name = $p_last_name.', '.$p_first_name;
            $participant_proper_name = $p_append ? $participant_proper_name.', '.$p_append : $participant_proper_name;
    
            if( array_key_exists( $participant_country['value'], $participant_countries_array_by_key ) ){
              $participant_countries_array_by_key[$participant_country['value']]["tooltipContent"] .= '<br>'.$participant_proper_name;
            }else{
              $participant_countries_array_by_key[$participant_country['value']] = array(
                "name"           => $participant_country['label'],
                "id"             => $participant_country['value'],
                "tooltipContent" => '<br>'.$participant_proper_name,
                "content"        => "",
                "useDefaults"    => "1",
              );
            }
          endif; // is a participant
        endforeach; // all users
      endif; // users not empty
      ksort( $participant_countries_array_by_key );
      foreach ($participant_countries_array_by_key as $pc) {
        array_push( $participant_countries_array, $pc);
      }
      /*
      echo '<div style="display:none">';
        echo '<h5 class="d-none">$participant_countries_array_by_key </h5>';
        echo '<pre class="d-none">';
        var_dump($participant_countries_array_by_key);
        echo ' </pre>';
        echo '<h5 class="d-none">$participant_countries_array </h5>';
        echo '<pre class="d-none">';
        var_dump($participant_countries_array);
        echo ' </pre>';
        echo ' </div>';
      */
      $meta['regions'] = $participant_countries_array;
      return $meta;
    }
    
    add_filter( 'igm_add_meta', 'vmg_igm_meta', 1 );
    
    Thread Starter mateusvitor

    (@mateusvitor)

    That’s ok. I’ll try to come up with some label system. I think there is none that I can use.

    • This reply was modified 5 years, 8 months ago by mateusvitor.
    Thread Starter mateusvitor

    (@mateusvitor)

    I finally managed to insert your PDF reader and the page gets replaced by your own page to download your plguin. Immediatly deleted your plugin.

    Thread Starter mateusvitor

    (@mateusvitor)

    That’s what I’ve searched far and wide. Nowhere in the WordPress.org page of your plugin or the your website I have found it.
    I contemplated if making it available in the gutenberg editor manually would be a challenge for me, but well, it’s not, not right now.
    I’d really like to use your plugin, because it does look like the best thing around, but it’s been way too cumbersome, I’ve spent many hours on it.
    Thank your for our work, I do believe it’s good stuff.

Viewing 15 replies - 1 through 15 (of 19 total)