views – Changes the query to an inner join subquery that links into two fields

I know that this question is asked again and again (I have found several), and each time it is a little different. Most of the answers I found are on Drupal 7 and I can not figure out how to handle it.

My basic problem
My basic problem is that I have nodes with one or more paragraphs. Each paragraph has a date field. I need each node only once in my result, but sorted after the first upcoming date.

Now it's no longer enough to just group and aggregate the node ID and the minimum number of paragraphs (field_date) because the actual paragraph needs to be rendered.

Also note that my actual case is a bit more complex than the one I am describing here, and that my Views query queries paragraphs (looking up at the node) rather than the other way round.

The required solution
I've tried different solutions, but I can not get them started yet.

I have created an SQL query that contains the required node IDs and data. The subquery generates two columns, let's call them "nid" and "field_date". For example:

nid    field_date
5      2019-10-10
10      2019-10-11
2      2019-10-12

My view is currently querying all paragraphs and joining the parent node. My approach would be to change the views query and inner join of my subquery for both "nid" and "field_date" to retain only the desired paragraphs.

What I can not figure out is:
– Can I just use my working MySQL query, or do I have to create a kind of query object first?
– How can I internally join a subquery and join it in two columns (I only see examples where joining takes place in a single column)
– Does anyone know of a good documentation or an article that explains all this?

Any help would be appreciated.

Drupal 8 views change the query to link inner join subqueries into two fields

I know that this question is asked again and again (I have found several), and each time it is a little different. Most of the answers I found are on Drupal 7 and I can not figure out how to handle it.

My basic problem
My basic problem is that I have nodes with one or more paragraphs. Each paragraph has a date field. I need each node only once in my result, but sorted after the first upcoming date.

Now it's no longer enough to just group and aggregate the node ID and the minimum number of paragraphs (field_date) because the actual paragraph needs to be rendered.

Also note that my actual case is a bit more complex than the one I am describing here, and that my Views query queries paragraphs (looking up at the node) rather than the other way round.

The required solution
I've tried different solutions, but I can not get them started yet.

I have created an SQL query that contains the required node IDs and data. The subquery generates two columns, let's call them "nid" and "field_date". For example:

nid    field_date
5      2019-10-10
10      2019-10-11
2      2019-10-12

My view is currently querying all paragraphs and joining the parent node. My approach would be to change the views query and inner join of my subquery for both "nid" and "field_date" to retain only the desired paragraphs.

What I can not figure out is:
– Can I just use my working MySQL query, or do I have to create a kind of query object first?
– How can I internally join a subquery and join it in two columns (I only see examples where joining takes place in a single column)
– Does anyone know of a good documentation or an article that explains all this?

Any help would be appreciated.

Plugins – How do I add fields on the Woocommerce Review tab? (as "Pro, Contra")

I am looking for a way to add 2 additional fields to the "Rating" tab in Woocommerce.
In this way, customers can add advantages in one area and disadvantages in another area.

I just want the review form to look like this:
Surname:
E-mail:
Pro & # 39; s:
Con & # 39; s:
Review:

* If there is a plugin that you know I would prefer to use a plugin.

Should custom post types and fields be in the design files or in a custom plug-in packed into the topic?

You will be excluded from the WordPress.org theme directory if you include these post types in the theme. The guidelines available here say:

Non-design-related functions are not allowed. (See: plugin
Area examples
)

And one of the examples is:

Custom post types and shortcodes

Regarding TGM, the guidelines are as follows:

  • subjects may not contain plugins
  • subjects Plugins can not be needed work
  • subjects can recommend Plugins from WordPress.org
  • Themes may only use TGM Plugin Activation or similar libraries to recommend and install plugins hosted on WordPress.org (by)
    With 'required' => false for each plugin)

So you will not be disapproved if you use TGM while your plugin is installed recommendedand not required.

However, this is a proven method, regardless of the directory rules. If post types are included in the topic, the user loses access to the content as the topic changes because the post types are no longer registered. This should not be done by changing topics. The content may not be displayed correctly in the new design, but the user will still have access to it.

Plugin Gravity Forms – Is it possible to trigger Zapier Hook during a post update and submit ACF fields?

I got into a kind of gherkin with a website and would be happy to help.

I'm trying to trigger a Zapier hook when updating a custom post type and sending all ACF fields with it. Is that possible?

Previously, I tried using Gravity Forms and the Advanced Post Creation add-on. I let Gravity View show the user the entry where he could edit it. The problem is that Advanced Post Creation only works when submitting posts, not updating.

So I just instructed the user to edit the post directly, but I do not know how to trigger the hook when a post is updated AND should send the ACF fields in the post with it.

If you can steer me in the right direction on any of the following things, that would be fantastic:

  1. Update a custom post type when updating an entry via Gravity View OR
  2. At least trigger a Zapier hook when a post is updated

Thank you very much!

unity – Public MonoBehavior string fields empty

That's bizarre enough that it Has I be to be an idiot.

I have a MonoBehaviour with some public fields and public methods:

public class MyComponentA : MonoBehaviour
{
    public string Message = "Foobar";
    public int Integer = 42;

    public string GetMessage() => "This is a message.";
    public int GetInteger() => 42;
}

I have added it to a prefab house called Circle_A,

Circle_B has a MonoBehavior that will instantiate an instance of Circle_A, get the component and log off the values ​​returned by the fields and methods:

public class CircleB : MonoBehaviour
{
    (SerializeField) private GameObject _circleAPrefab;

    private void Start()
    {
        var circleAInstance = Instantiate(_circleAPrefab, new Vector2(10, 10), Quaternion.Euler(Vector3.zero),transform);
        var myComponentA = circleAInstance.GetComponent();
        var message = myComponentA.Message;
        LogIt(message);
        LogIt(myComponentA.GetMessage());
        LogIt(message);
        Log(myComponentA.Integer);
        Log(myComponentA.GetInteger());
    }

    private static void LogIt(string message)
    {
        switch (message)
        {
            case null:
                Log("NULL");
                return;
            case "":
                Log("EMPTY");
                return;
            default:
                Log($"'{message}'");
                return;
        }
    }
}

The integer field and both methods return the number as expected 42 and the messageThis is a message, However, the message field is always an empty string.

What's happening?

seo – (JSON-LD) Add recommended fields that are not visible on the page

I use the type "GovernmentOrganization" to describe content on my homepage. I listed GovernmentOffice sub-organizations and filled in the following fields for each of them: name, phone, and picture. All these articles are available on my homepage.

However, if you enter my code through https://search.google.com, you'll be warned that additional fields are required: address and price range. This information is not visible on my homepage but is included more deeply on the site.

Is it okay to add this to my homepage JSON-LD if it is not visible as long as the sub-organization has other visible information? Or does everything have to be visible? And if so, what are the best ways to avoid duplicating or extra maintenance on JSON-LD across multiple pages?

Homepage Example:

{
        "@context": "https://schema.org",
        "@type": "GovernmentOrganization",
        "name": "Sample Government",
        "address": {
            "@type": "PostalAddress",
            "streetAddress": "123 4th St.",
            "addressLocality": "Los Angeles",
            "addressRegion": "CA",
            "postalCode": "90001"
        },
        "image": "https://sampleGov.com/img1.png",
        "url": "https://sample.com",
        "sameAs": [
            "https://www.facebook.com/sampleGov/",
            "https://twitter.com/sampleGov"
        ],
        "SubOrganization":[
        {
            "@type": "GovernmentOffice",
            "name": "Board of Supervisors",
            "telephone": "+1-818-111-2222",
            "image": "https://sampleGov.com/img2.png"
        },
        {
            "@type": "GovernmentOffice",
            "name": "Assessor",
            "telephone": "+1-818-222-3333",
            "image": "https://sampleGov.com/img3.png"
        },
        {
            "@type": "GovernmentOffice",
            "name": "Election's Office",
            "telephone": "+1-818-444-5555",
            "image": "https://sampleGov.com/img4.png"
        }
    ]
}

Encoding style – named fields vs. compactness

Are there any guiding principles for choosing between named fields instead of compactness?

const replacements = (
  { from: 'apple',  to: 'manzana' },
  { from: 'banana', to: 'plátano'  },
);

function replace(str, replacements) {
  for (const {from, to} of replacements) {
    str = str.replace(from, to);
  }
  return str;
}

vs

const replacements = (
  ( 'apple', 'manzana' ),
  ( 'banana', 'plátano' ),
);

function replace(str, replacements) {
  for (rep of replacements) {
    str = str.replace(...rep);
  }
  return str;
}

I think I prefer the first example. It feels documented and clearer to me. The second example is not clear to me, especially if the input data is separated from the function. I mean, if I only see it in a library like in

const newStr = replace(str, (
  ( 'apple', 'manzana' ),
  ( 'banana', 'plátano' ),
));

seems far less clear than

const newStr = replace(str, (
  { from: 'apple',  to: 'manzana' },
  { from: 'banana', to: 'plátano'  },
));

Is there a principle that needs to be decided, or is it just a personal preference?

Sometimes there are criteria. For example, if the data includes 100,000 entries, compactness may outweigh any other criteria. In this case, one could even claim that a single dimensional array becomes even more compact (and more confusing).

const newStr = replace(str, (
  'apple', 'manzana',
  'banana', 'plátano',
));

that is just a little less incomprehensible than

const newStr = replace(str, ('apple', 'manzana', 'banana', 'plátano'));

But are there any memory issues besides other criteria that can be used to judge which style to use? There are many occasions when the use of the spread operator suggests compactness, but makes the code look cryptic.