loop – How can I order all subcategories alphabetical independent of the parent categories?

These are my hierarchical three level categories:

- Top-Level Cat 1
  - Sub1A
    - Subchild1A1
    - Subchild1A2
  - Sub1B
    - Subchild1B1
    - Subchild1B2
- Top-Level Cat 2
  - Sub2A
    - Subchild2A1
    - Subchild2A2
  - Sub2B
    - Subchild2B1
    - Subchild2B2
...

Is it possible to get all bottom level category names (the subchildren) and sort them alphabetically independent of the parents? I get all subchildren categories, but they are only orderer alphabetical inside their top level category.

For example I get

Bosnia
Sweden
Congo
Southafrica

From the top level categories Europe and Africa.

But I want to get:

Bosnia
Congo
Southafrica
Sweden

8 – How to get parent paragraph from a child block preprocess

Searched all over the place but cannot find anything similar. Here’s the issue…

The setup:

  • ‘Page’ content type
  • ‘Block Content’ paragraph type

The ‘Page’ content type has a field for referencing the ‘Block Content’ paragraph, called “Components” (set to unlimited). Now we can use paragraphs within our page. Simple.

The ‘Block Content’ paragraph type has a field for referencing blocks (using the module Block Field). It also has two other fields for title and subtitle. These fields need to be displayed on the referenced block template for this paragraph instance. This is the issue.

I have included some images to show the setup.

I am trying to use theme_preprocess_block to inject these fields (title and subtitle) into the correct block using $vars(‘plugin_id’) from the block preprocess but the issue is that the block does not know its paragraph parent. And if I don’t know the parent, I can’t retrieve these fields that I need to inject into the block.

This answer suggests using the following to get the parent:

$parent   = $variables('elements')('#node')->_referringItem->getEntity();

But in my case I could not find anything equivalent in my block preprocess function.

Update 1:

I tried (from within theme_preprocess_block):

dpm($vars('elements')('content')('#block_content')->_referringItem->getEntity());

This give the following error:

Error: Call to a member function getEntity() on null in limit_preprocess_block__banner_block()

Update 2:

I just dumped the $vars from the preprocess function and noticed that there seems to be the paragraph id in there. But I don’t know how to access it from the $vars variable. Is it possible? (see dump image below)

enter image description here

IMAGE 1:

enter image description here


IMAGE 2:

enter image description here


IMAGE 3:

enter image description here


IMAGE 4:

enter image description here


IMAGE 5:

enter image description here

javascript – How can a parent vue component listen to a iframe event which is a HTML page?

I’ve created a component that stores an iframe

<template>

<iframe height=1000 width=100% :src="full" @myEvent="thisMethod" ></iframe>

</template>

<script>
export default {
    data() {
        return {
            path: '../lib/pdfjs-2.7.570-dist/web/viewer.html',
            name:'../t1.pdf',
            full: '../lib/pdfjs-2.7.570-dist/web/viewer.html?file=pdfs/t1.pdf'
        };
    },
  props: {
    fileName: String,
    path:String
  },

  methods:{
    thisMethod(){
        console.log("Hello from Parent")
    }
  }
}
</script>
<style scoped>
div {
  width: 50%;
  height: 79vh;
  min-width: 400px;
}
</style>

Inside my viewer.html I want to fire an Event to my parent so that ‘thisMethod’ would be called.
I’ve tried doing:

<html>
 A lot of HTML tags
</html>
<script>
      function myfunction(data){
         this.$emit('myEvent',data)
      }
</script>

but viewer is a html page and I can’t seem to find a way to send an event from a .html file to a .Vue file.
My question is basically what would be a solution to be able to handle a JavaScript event in a HTML page inside a .vue parent page ?

public key infrastructure – What are requirements of Key Usage extension of parent and child certificates?

https://tools.ietf.org/html/rfc5280.html#section-4.2.1.3 has this to say:

If the keyUsage extension is present, then the subject public key
MUST NOT be used to verify signatures on certificates or CRLs unless
the corresponding keyCertSign or cRLSign bit is set. If the subject
public key is only to be used for verifying signatures on
certificates and/or CRLs, then the digitalSignature and
nonRepudiation bits SHOULD NOT be set. However, the digitalSignature
and/or nonRepudiation bits MAY be set in addition to the keyCertSign
and/or cRLSign bits if the subject public key is to be used to verify
signatures on certificates and/or CRLs as well as other objects.

So the expectation is that a CA’s KeyUsage will assert { keyCertSign | cRLSign } without asserting digitalSignature. And the end-entity/leaf cert will of course want to assert digitalSignature, therefore there’s no expectation of subsetting.

categories – Embed Gravity Forms ID based on parent post category

I’m using Gravity Forms as the main contact form on a classified ad website built on WordPress, the site has 3 parent categories and I prepared 3 different contact forms respectively, I already embedded one of the forms which is displayed globally but I’m trying to filter out the Form output based on the parent category of the post.

Current embed code for the generic Contact form (ID: 11) is:

<?php
/* Gravity Form embed for all categories  */

gravity_form( '11', $display_title = false, $display_description = false, $display_inactive = false, $field_values = null, $ajax = true, $tabindex, $echo = true );
?>

Ultimately I am looking to figure out how to fetch the parent category of the post and show the relevant GF form based on that category.

So if the post of the user is listed under “Category 1” -> display GF ID:1, else if post is listed under “Category 2” -> display GF ID:2 and so forth.

P.S.: Embedding the form is the only way, I cannot use ShortCodes

Any guiding tips on how to achieve this would be appreciated.

seo – How to tell search engines that the parent category is more important for ranking?

I am working on an e-commerce website, called Shopless. We have lots of categories, for example the screenshot below show the categories for our job section:

enter image description here

The page: shopless.co.nz/jobs is the main job URL and it has the following sub categories
shopless.co.nz/jobs/accounting
shopless.co.nz/jobs/engineering
shopless.co.nz/jobs/trades-and-services

and so on…

And the job adverts have a url like this: shopless.co.nz/jobs/accounting/12343
Also note that jobId=12343 expires within a couple of weeks.

Now when someone searches for the term “Find Job Shopless”, he gets the following result.

enter image description here

As you can see Google is not showing the parent page, which is shopless.co.nz/jobs at the first position… instead it is showing individual sub-categories Accounting and Information Technology. What should I do Google recognizes the parent page more important and display it on the top?

postgresql – Deleting rows from child table without deleting from parent

I have 2 tables , connected with inheritance.
I want to delete some rows from the child table when datetime>2days. The deletion part works , but it deletes rows from the parent as well.

    CREATE OR REPLACE FUNCTION earthquakes_trigger()
    RETURNS TRIGGER AS $$
    BEGIN
        INSERT INTO earthquakes VALUES (NEW.*);
        DELETE FROM ONLY earthquakes WHERE datetime < (now() - '2 days'::interval);
        RETURN NULL;
    END;
    $$
    LANGUAGE plpgsql;
    
    CREATE TRIGGER earthquakes_trigger
            BEFORE INSERT ON earthquakes_ovr
            FOR EACH ROW EXECUTE PROCEDURE earthquakes_trigger();

Parent table : earthquakes_ovr
Child table: earthquakes

PS. I also tried to “break” the trigger function , to have the deletion part as a child trigger function ,but it didn’t work as well.

shortcode – Check if parent page has child page of certain slug

I currently have a function that checks to see if the page is a parent, and if so, do stuff. But I also want to check to see if the parent has a child page that has a certain slug.

Basically, how would I check to see if a WordPress page has a child that matches a slug of my-child-slug?

In short, this is my current function:

/* Using Slug, make iconbox Shortcode */
function fs_sc_location_iconbox( $atts ){ 
    // begin output buffering
    ob_start();

    global $post; // if outside the loop

    $response = 'Nothing to see here';

    if ( $post->post_parent ) {
        // This is a subpage
        $slug = $post->post_name;

    } else {
        // This is not a subpage
        $slug = $post->post_name;

        // Check if has child page with slug of my-child-slug
        // ** NEED LOGIC HERE **

        // if this parent page has a child with the desired child slug...
        $response = 'Yes, this parent has a child page that we are looking for.';

    }

    // if there is a slug
    if ($slug) {
        // output the default response, unless this page is a parent of the desired child page
        echo $response;
    }
    // end output buffering, grab the buffer contents, and empty the buffer
    return ob_get_clean();
}
add_shortcode( 'fs_location_iconbox', 'fs_sc_location_iconbox' );

How can I updated te // ** NEED LOGIC HERE ** area, so that it checks if this parent page has a child of the my-child-slug slug? And if so, then it will set a new value for the $response variable.

cp – Safest way to move a mount point that is a parent of other mount points on Linux to a new physical device

I goofed up and /var/lib/kubelet was not mounted on a server. So it was on the root. I noticed this and I want to fix it. I did the stupid thing and just tried to stop the associated services (kubelet), rename the existing directory to /var/lib/old_kubelet, mounted /var/lib/kubelet, and then tried to mv /var/lib/old_kubelet/* /var/lib/kubelet.

It turns out there are many (20ish) mount points underneath /var/lib/kubelet.

So when I tried to move or copy, it actually tried to copy the contents of those mount points!

What’s the easy and safest way to move the contents without copying the child mount points?

Other probably irrelevant information: the block device that the mount point should be pointing to is a LUKS volume

entities – Create a view of the first entityreferenced child item from a multifield for a list of parent nodes

I have a node type A containing a multifield of entityreferences to another node type B and using only the views admin interface I want to create a list of the first type B child entityreference on every node of type A.

I think its possible just can’t quite figure out how to do it.

Thanks