How to force custom default Sort By options for all folder types in Windows Explorer

Quick note to eager mods: this is not a duplicate 🙂

My question has 3 parts:

  • I wish to understand how Windows Explorer works in the sense of why this happens. I know folders can be of different types (general, music library, photo gallery etc) and that windows automatically decides which is which continuously based on what’s in a folder. There’s also different (types of) drives in a system, external drives, music player drives, phone drives whatever. All of these in addition to it being a folder by folder setting, contribute to the problem but I can’t piece together how come the Sort By items lists get reset.

    • For instance: I go to D:Downloads in Explorer and go to Sort By and go to More and scroll all the way down to Date Modified, and click okay, then go to Sort By again and select Date Modified. Cool. Now, I go in my browser and save a file, browser asks where to save, I browse to D:Downloads GUESS WHAT? DATE MODIFIED ISN’T THERE. Ok, I set it again there as well. I open another program with another windows shell browse menu, date modified isn’t there either. I set all of them, reboot and/or install a totally useful windows update, it gets reset again.
    • ^ Why is it not even actually per folder but per shell, and why does the Sort By list get reset? Where is this setting stored?
  • I normally would have asked what most seemingly related questions on this topic on SU ask:

    • How to change my Sort By options and then apply them to all folders. – Bad question to ask and answer, because it will get reset, or will not really be applied to all types of folders and all future drives and connected devices.
    • How to force all the folders on my system to be a “general items” folder so that then I can change the Sort By options for all my general items folders. – Also a bad question because a. I want to have different types of folders not just general items folders, and b. it as sure as anything in the universe, will eventually get reset by MS whether on purpose, or design stupidity.
  • If you’ve made it this far and with this knowledge think you have an elegant answer please help us. Otherwise, I’m gonna ask a different question:

    • Is there any sort of shell extension hack or background process or something, that we can use, that continuously overwrites the Windows Explorer Sort By list with the Sort By criteria of –OUR– choosing? Thank you very much.

In the last years, Windows As A Service releases have brought huge overhauls and investments, questionable at best (e.g. making windows drivers hostage to the invasive app store nobody wants), and yet everyday-things like this problem have remained broken and unanswered for decades. Makes you question whether anyone working at MS uses their own product non-superficially. No, but I’m sure they care, I guess they gosh just still don’t have enough telemetry to know that this totally-in-your-face basic QA problem is a problem…

custom post types – How to get rewrited name of cusom taxonomy?

I have registered custom post taxonomy with rewrited name:

register_taxonomy('behold_gallery-albums-subject', 'behold_gallery',array(
    'hierarchical'              => true,
    'labels'                    => $labels,
    'show_ui'                   => true,
    'show_admin_column'         => true,
    'rewrite'                   => array( 'slug' => 'kategorie-galerii', 'with_front' => true ),
    'update_count_callback'     => '_update_post_term_count',
    'query_var'                 => true,
));

so name of my custom taxonomy is ‘behold_gallery-albums-subject’ but is rewrited to ‘kategorie-galerii’.

If I want to get name of this taxonomy, I can use this

$postsTaxonomy = get_sub_field('archive__post-choose-taxonomy'); // ACF
$postsTerm = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
$postsTerm_id = $postsTerm->term_id;
$PostsTaxName = get_taxonomy($postsTaxonomy)->labels->name;

but how can I get this rewrited name, not the ‘original’?

Thanks!

typescript – Typescrip no react, instalação com @types

Estou querendo instalar uma biblioteca que insere um input do estilo time, na seguinte instalação

npm install react-time-picker

E para instalar o typescript seria o

npm install @types/react-time-picker

So que da o seguinte erro

npm ERR! 404 Not Found – GET https://registry.npmjs.org/@types%2freact-time-picker – Not found
npm ERR! 404
npm ERR! 404 ‘@types/react-time-picker@latest’ is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Pelo que entendi isso significa que não existe o types dessa biblioteca?
Se sim, existe alguma solução?

custom post types – Changing CPT permalink

I have a CPT named rad.

I have the following code to change the permalink from “site.com/rad/post” to “site.com/category/subcategory/post”.

 function remove_cpt_slug( $post_link, $post, $leavename ) {
// Define the CPT's name.
$post_type_name="rad";
// Get the inmediate category.
$categoryc=get_the_category( $post->id );
// Get the parent category.
if(!empty($categoryc))
     $categoryp=get_term( $categoryc(0)->parent, 'category' );

if ( $post_type_name != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}

if(!empty($categoryp->errors)) {
$post_link = str_replace( $post_type_name , $categoryc(0)->name, $post_link );
}

if(empty($categoryp->errors) && !empty($categoryp->name)) {
$post_link = str_replace( $post_type_name , $categoryp->name."/".$categoryc(0)->name, $post_link );
}
    return $post_link;
 }
 add_filter( 'post_type_link', 'remove_cpt_slug', 10, 3 );

When I create a new post, it works great. However, when I visit the new permalink it gives a 404 error.

Any idea of how could I fix it?

javascript – Creating two different posts types on my Gatsby site – rewriting my gatsby-node.js

I need to identify the different markdown files I have so I can create a unique url structure for them. I can already identify “notes” files, and want to create a second type called “projects”.

My gatsby-node.js file looks like this right now

const path = require('path');
const { createFilePath } = require('gatsby-source-filesystem');

// Look at every node when it is created
exports.onCreateNode = ({node, getNode, actions}) => {
    // Check for markdown nodes
    const { createNodeField } = actions;
    if(node.internal.type === 'MarkdownRemark') {
        // Create a slug out of the markdown filepath name
        const slug = createFilePath({
            node,
            getNode,
            basePath: 'notes'
        });
        // Add the newly created slug to the node itself
        createNodeField({
            node,
            name: 'slug',
            value: `/note${slug}`
        });
    }
};

exports.createPages = ({ graphql, actions }) => {
    const { createPage } = actions
    return new Promise((resolve, reject) => {
      graphql(`
        {
          allMarkdownRemark {
            edges {
              node {
                fields {
                  slug
                }
              }
            }
          }
        }
      `).then(result => {
        result.data.allMarkdownRemark.edges.forEach(({ node }) => {
          createPage({
            path: node.fields.slug,
            component: path.resolve(`./src/templates/note.js`),
            context: {
              // Data passed to context is available in page queries as GraphQL variables.
              slug: node.fields.slug,
            },
          })
        })
        resolve()
      })
    })
  };
```