Add custom fields in the new and edit the site forms without touching the WP core

I am working on a custom plugin to add some extra fields in each forms of user and site. Therefore, I need to add few custom fields in the both new/edit site and user forms. Just to know if there is a way for me to add custom fields when I create or edit the site and users through Network admin panel without touching the WP core.

Edit Woocommerce Pricing Formula

I need to edit the way woocommerce calculates the price on a client’s website. It’s a site that allows customers to purchase products on credit by choosing the number of months they wish to make payment. However, in the cart, if the customer selects 2 or more of the quantity of the product they wish to purchase, the total amount of the products appears in the "Price" column of the cart instead of the unit price of that product. I would like to edit it such that the unit price shows in the price column no matter the quantity selected and then the total amount can then show in the total and subtotal columns. I have tried editing the woocommerce cart file and a couple of others but nothing seems to work. This is the site: www.appliancepointgh.com Any help on how i can do this would be deeply appreciated.

What is the difference between these two Edit Distance Algorithm

Edit Distance is very well known problem in computer science. Came up with following algorithm after reading through CLRS but it doesn’t work. Check the working algorithm below, I couldn’t find why first algorithm doesn’t work while second one does.

  public int find (String word1, String word2, int i, int j, int count) {     if (i >= word1.length()) return  count + word2.length() - j;     if (j >= word2.length()) return  count + word1.length() - i;      if (dp[i][j] != -1) return dp[i][j];      if (word1.charAt(i) == word2.charAt(j)) {         dp[i][j] = find(word1, word2, i+1, j+1, count);     } else {         int replace = find(word1, word2, i+1, j+1, count + 1);         int delete = find(word1, word2, i+1, j, count + 1);         int insert = find(word1, word2, i, j+1, count + 1);                  dp[i][j] = Math.min(replace, Math.min(delete, insert));     }      return dp[i][j]; } 

Notice, how I’m passing the cost of edit in method argument. Now, the algorithm which works. Here I’m not passing the edit distance in the method parameter instead of I’m adding 1 to recursive method.

  public int find (String word1, String word2, int i, int j) {     if (i >= word1.length()) return  word2.length() - j;     if (j >= word2.length()) return  word1.length() - i;      if (dp[i][j] != -1) return dp[i][j];      if (word1.charAt(i) == word2.charAt(j)) {         dp[i][j]  = find(word1, word2, i+1, j+1, count);     } else {         int replace = find(word1, word2, i+1, j+1, count + 1);         int delete = find(word1, word2, i+1, j, count + 1);         int insert = find(word1, word2, i, j+1, count + 1);                  dp[i][j] = 1 + Math.min(replace, Math.min(delete, insert));     }      return dp[i][j]; } 

I’m not able to think why first algorithm fails. Appreciate, if you can point my error in understanding.

Use Mathematica to edit TeX file

I have a large (>300 page) latex project split across multiple .tex files that I have decided I want to change some notation around in. A minimal working example would be a main file main.tex that reads

\documentclass{book} \usepackage{amsmath} \newcommand{\funct}[2]{f \left( #1 , #2 \right)} \begin{document} \include{ch1} \end{document}

with ch1 reading

\chapter{Chapter 1} words words words $ \funct{a}{b}$ words word $ \funct { \sum_{k=1}^\infty \frac{1}{k^2}} {\lim_{n\to \infty} n }$

and so forth. Now, I’ve decided that I would like to globally reverse the inputs of \funct. Changing main.tex to \newcommand{\funct}[2]{f \left( #2 , #1 \right)} would do the exact right thing, except that this would be really psychedelic and problematic for any future editing. As such, I need to go through and reverse ever instance of this macro being used in the individual tex files, i.e., replace \funct{a}{b} with \funct{b}{a}. The problem is that there are…hundreds?…of instances of this macro being used among the various tex files, not to mention that the individual inputs to this macro are often several lines worth of latex. Basically, going through by hand would be an absolute nightmare and necessitate several days worth of hunting down typos.

As such, I’ve had the thought of trying to use some of Mathematica’s string pattern matching to do this reordering automatically. After making ALL THE BACKUPS, I’ve gotten as far as:

ch1=Import[<file path for ch1.tex>, "String"] StringCases[ch1, "\funct{"~~_~~"}{"~~_~~"}"]

Before getting hopelessly stuck. In particular, Mathematica doesn’t seem to like all the \ characters, not to mention the issues of inconsistent spacing between braces, nor dealing with matched sets of nested open/close braces (e.g., the second \funct { ....} {...} above).

Any suggestions? Or is this going to become a quagmire, and I would be better off just brewing a pot of coffee and getting busy with the old ctrl-x ctrl-v routine?

How to enable the option “edit physics shape” in the Sprite Editor?

I can successfully import .png files, create tilesets, and use them in my tilemaps in Unity. Thanks to DMGregory, I just learned that there exists an option to customize the Tilemap Collider 2D in the Sprite Editor, which allows me to set a custom collider for every tile instead of going through them one by one.

The steps I follow while creating a tileset in Unity is as follows.

  1. Import the .png file.
  2. Open the Sprite Editor.
  3. Select the option Multiple for Sprite Mode.
  4. Select Slice from the Sprite Editor.

Then, I create a Tile Palette in a folder, drop and drag my created tiles, and start creating my level.

I have never encountered the option to modify the colliders tile by tile. What am I doing wrong?

How can I create or edit posts in bulk with featured images?

I am changing the structure of my site in a way that basically requires me to recreate every post. I have been looking into bulk post creation tools but the ones I find only let me set up a title, and not a featured image, date or description.

Is there a way to create posts in bulk with featured images? Or is there a way to export the posts in a table format that I can edit in bulk and then import?

PD: I have tried using WP All export and WP All import and they require the PRO version to import images.

function to lock buddypress username from edit and automatically generate it

Was wondering if someone could recommend a function with buddypress that would both automatically change a user’s buddypress username to “First name” xprofile field + randomly_generated_characters as well as prevent the user from being able to change their username. I’m hoping this is possible because let’s just say our students are getting ‘creative’ with their usernames 🙂

Any help would be wonderful!

Thanks for this and all of the support you guys give us!