Strange custom fields data lost

I have a weird problem with my WordPress. I am here for almost two months. Can someone help me please? Please be my life saver …

The matter:

When I publish a post with data in all fields (original and custom), everything seems to be fine. But after a few days (on average 3-7 days) the data from my custom fields disappear (only) and I do not understand why. I have already disabled all plugins and still have the same problem. Probably the problem is in my code for the theme functions.php, right?

Is there some kind of soul that has enough time to check my code to see if this can be caused by anything, please?
My functions.php code: https://paste2.org/VvzxAdwA

The custom fields I have and where the data disappears after a few days are:

mr_magnifying_glass

mr_random_post
mr_feature_video

today_offer

site_id1
site_id2
site_id3
site_id4
site_id5
site_id6
site_id7
site_id8

mr_active_discount
mr_topdeal_discount
mr_new_discount
mr_lifetime_discount
mr_discount_des
mr_discount_Image
mr_discountbutton_url

mr_quility_des
mr_content_des

mr_month_price
mr_month_off
mr_month_lastrice
mr_month_price_2
mr_sixmonth_price
mr_sixmonth_off
mr_sixmonth_lastrice
mr_per_month3
mr_threeyear_price
mr_threeyear_off
mr_threeyear_lastrice
mr_per_month6
mr_fiveyear_price
mr_fiveyear_off
mr_fiveyear_lastrice
mr_per_month12

mr_feature1
mr_feature2
mr_feature3
mr_feature4
mr_feature5
mr_feature6

Catag
domaintag
post_external_link
joink_external_link
titletag

Use extra-Site[]

I do not know if that helps …

Please help me, I do not know what else to do …

Thank you guys!

Javascript – detect mouse-click position in text fields in text coordinates

You can get the position of the mouse in pixels and the position of the insertion point in a text area above selectionStart,

But how do you get the place in text coordinates right after a mouse click?

The problem is that the caret did not move at the time of shutdown, so you get the previous location.

textarea.addEventListener (& # 39; mousedown & # 39 ;, event => {
console.log (textarea.selectionStart) // logs the previous location
})

Theming – Get fields from a view into a branch from a custom display style

That's why I've created a custom display style that follows a tutorial and allows you to use fields. However, I can not figure out what the variables in the branch file should be to display the desired fields.

My PHP looks like this

class Slider extends StylePluginBase {



/ **
* {@inheritdoc}
* /
protected function defineOptions () {
$ options = parent :: defineOptions ();
$ options['path'] = array (& # 39; default & # 39; => & # 39; slider & # 39;);
return $ options;
}

/ **



* Does the style plugin itself support adding fields to its output?
*
* @var bool
* /
protected $ usesFields = TRUE;



/ **
* {@inheritdoc}
* /
public function buildOptionsForm (& $ form, FormStateInterface $ form_state) {
parent :: buildOptionsForm ($ form, $ form_state);

// path prefix for SLIDER links.

$ form['chooseImage'] = [
      '#title' => $this->t('Choose Image'),
      '#type' => 'select',
      '#description' => t('Choose where to position the title and text in the slider'),
      '#options' => ['cc' => $this->t('Center'), 'tl' => $this->t('Top Left')].
];

}

I create a topic function for the view.

Function slider_theme ($ existent, $ type, $ theme, $ path) {
Return Array (
& # 39; slider & # 39; => array (
& # 39; file & # 39; => & # 39; extended_display_styles.theme.inc & # 39 ;,

)
);
}

I can add options in the theme.inc advanced display styles file, but I do not know how to add the view variables.

    Function template_preprocess_views_view_slider (& $ variables) {
// Show user-defined options.


$ options = $ variable['view']-> style_plugin-> options;

// Create a two-dimensional array with years and months.
$ time_pool = array ();
$ frameArrayManual = array (& # 39; a & # 39 ;, & bgr ;, & # 39; c & # 39;);
// $ options['manual'] = $ Variables['view']-> style_plugin-> manual;

foreach ($ variable['view']-> result as $ id => $ result) {
$ created = $ result-> node_field_data_created;
$ created_year = date (& # 39; Y & # 39 ;, $ created);
// Date format of the month.
$ month_date_format = (isset ($ options['month_date_format']))? $ options['month_date_format'] : & # 39; m & # 39 ;;
$ created_month_digits = date (& # 39; m & # 39 ;, $ created);
$ created_month = date ($ month_date_format, $ created);
$ time_pool[$created_year][$created_month_digits]    = "$ created_month";
}

$ options['time_pool'] = $ time_pool;
$ options['frameArrayManual'] = Array (& # 39; a & # 39 ;, & bgr ;, & # 39; c & # 39;);

// Update the options for twig.
$ variable['options'] = $ options;
}

I can not find any resources to find out.

Strange custom fields data lost

Hi Guys,

I have a weird problem with my WordPress. I am here for almost two months. Can someone help me please? Please be my life saver …

The matter:

When I publish a post with data in all fields (original and custom), everything seems to be fine. But after a few days (on average 3-7 days) the data from my custom fields disappear (only) and I do not understand why. I have already disabled all plugins and still have the same problem. Probably the problem is in my code for the theme functions.php, right?
SEMrush

Is there some kind of soul that has enough time to check my code to see if this can be caused by anything, please?
My functions.php code: paste2.org/VvzxAdwA

The custom fields I have and where the data disappears after a few days are:

mr_magnifying_glass

mr_random_post
mr_feature_video

today_offer

site_id1
site_id2
site_id3
site_id4
site_id5
site_id6
site_id7
site_id8

mr_active_discount
mr_topdeal_discount
mr_new_discount
mr_lifetime_discount
mr_discount_des
mr_discount_Image
mr_discountbutton_url

mr_quility_des
mr_content_des

mr_month_price
mr_month_off
mr_month_lastrice
mr_month_price_2
mr_sixmonth_price
mr_sixmonth_off
mr_sixmonth_lastrice
mr_per_month3
mr_threeyear_price
mr_threeyear_off
mr_threeyear_lastrice
mr_per_month6
mr_fiveyear_price
mr_fiveyear_off
mr_fiveyear_lastrice
mr_per_month12

mr_feature1
mr_feature2
mr_feature3
mr_feature4
mr_feature5
mr_feature6

Catag
domaintag
post_external_link
joink_external_link
titletag

Use extra-Site[]

Code (surcharge):

I do not know if that helps …

Please help me, I do not know what else to do …

Thank you guys!

Fields – editable and selectable setting Incorrect in notation

With the notation package I have defined a custom notation for chemical reactions. A minimal example is below (I will explain the commented out part the same):

needs["Notation`"]
notation[ParsedBoxWrapper[
         RowBox[{"a_", TagBox["[LongRightArrow]"
Identity, SyntaxForm -> "[Equal]"
(*, Editable-> Incorrect, Selectable-> Incorrect *)
].
"B_"}]][DoubleLongLeftRightArrow]ParsedBoxWrapper[
         RowBox[{"LongRightArrow", "[", "a_", ",", "b_", "]"}]]]notation[ParsedBoxWrapper[
         RowBox[{"a_", OverscriptBox[TagBox["[LongRightArrow]", Identity,
SyntaxForm -> "[Equal]"
(*, Editable-> Incorrect, Selectable-> Incorrect *)
].
"K_"].
"B_"}]][DoubleLongLeftRightArrow]ParsedBoxWrapper[
         RowBox[{"LongRightArrow","[","a_",",","b_",",","k_","]"}]]]AddInputAlias["rxn" -> ParsedBoxWrapper[
              TagBox["[LongRightArrow]", Identity, SyntaxForm ->" [Equal]"
(*, Editable-> Incorrect, Selectable-> Incorrect *)
]]]

The first notation entry defines a reaction with reactants and products. The second entry notation defines a reaction with reactants and products as well as a rate constant that is positioned above the arrow. The TagBox is needed to change the priority of LongRightArrow so that the parser does not swap reactants and products. You can enter an example reaction as follows:

Enter image description here

The problem is that there are two cursor positions on either side of the long arrow to the right, which are probably inside the tag box and outside the tag box. Entering reactants or products in the tag box or switching to the superscript box within the tagbox will break the notation assignments. So I want to remove them as possible cursor positions. See below:

Enter image description here

I did something similar for a complex symbol package that I put together with the Editable-> False-> Selectible-> False approach within a style definition, but it does not seem to work here. , If I replace the TagBox with a TemplateBox and apply the previously used style, I still have two different areas where the cursor can be outside the arrow.

Any suggestions? Many Thanks!

magento2 – sorting by position fields

This is my collection function:

public function getCollection ()
{
$ searchCriteria = $ this-> searchCriteriaBuilder-> addFilter (& # 39; status & # 39 ;, & # 39; 1 & # 39;) -> create ();

$ someCollection = $ this-> someRepositoryInterface-> getList ($ searchCriteria);

return $ someCollection-> getItems ();

}

As far as everything works fine.

The filter works without any problems, all activated elements are displayed.

I need help sorting. I have a field called "Position". I have to show the articles in ascending order. What I mean by that is that "position 1" should be displayed first, secondly below the first, etc.

I suppose there should be an easy way to do that, but I can not find it …

Suggestions are greatly appreciated.

GUI Design – How do I use input fields that automatically get a value when I fill in the form?

Imagine we have a warehouse management system. It contains a form in which the user can place an order. The order has some features like:

  • date
  • supplier
  • User who ordered it
  • total price
  • VAT in percent
  • To pay tax in cash

On the right side of the form is a section (actually another form) where you can add products to the order.
The user fills in the order properties (see bullet points above) and adds products to the order.

The total price of the order should only be the sum of the prices of all products added to this order. Therefore, the value can be updated with the correct total price when the list of added products changes. At the same time, this field must be editable because the user may need to be able to change the total price regardless of the actual total price of the products.
The same applies to the tax rate and Tax in money Fields. They must automatically be filled with the correct value based on the default conditions, so that the user can enter fewer fields and leave them with their automatically filled values.

Of course it is contradictory: first, the fields should be filled with a calculated value while the user is busy on the form. On the other hand, the user must be able to easily change the value without the problem of overwriting the user value each time the form recalculates and fills in the automatic fields.

I thought of a comp button or something, but that does not seem to be very clean. The goal is to make the form as smart as possible and to get the user typing, thinking and calculating as little as possible.

Plugins – Build a meta-key array with multiple input values ​​from fields

I'm trying to use UserFrontend on WordPress to create a custom form, and I need to copy an array from one of WooCommerce's familiar meta keys. I'm just not sure how to tackle this problem because each field returns only one value. What I really need is for the user to enter a date range and translate a portion of an array for that meta key value.

I tried creating custom field groups, but they do not appear in UserFrontend

This is the field that can be accessed in the admin backend: Date selection in WooCommerce

that's how it must look like …

_wc_booking_availability (this is the meta key)

This is the returned value:

Array (
0 =>
Array (
0 =>
Array (
& # 39; type & # 39; => & Custom 39,
& # 39; available for booking & # 39; => & # 39; yes & # 39 ;,
& # 39; priority & # 39; => 10,
& # 39; from & # 39; => & Nbsp; 2019-05-13 & # 39 ;, // this was set with a date picker
& # 39; to & # 39; => & # 39; 2019-05-27 & # 39 ;,
)
)
)

wp query – WP_QUERY with group by with custom fields

I need to use group by in my posts with a custom eventMonth field that contains values ​​like "April-2019" – "June-2019".

(I never used the wp_query with meta_query data, so …).
I have the next query and the next code in my category field function

query_group_by_filter ($ groupby) {
global $ wpdb;
Return $ wpdb-> postmeta. "meta_value = & # 39; eventMonth & # 39;"
}:

$ query = array (
"category_name" => "events",
"posts_per_page" => - 1,
"order" => "ASC",
"meta_query" => array (
& # 39; relation & # 39; => "OR",
Array (
& # 39; key & # 39; => "eventMonth",
& # 39; compare & # 39; => "="
)
)
& # 39; # 39 & meta_key; => "eventMonth"
);

add_filter (& # 39; posts_groupby & # 39 ;, query_group_by_filter & 39;);

If I make the loop, I can only see 1 result if I have four posts with this custom field.

How could I go through this group?

Thanks for your help!