WordPress change title with custom dynamic

I have created a custom php template file, which I use to filter results, based on user choice. I get the user’s choice with the following code

$  bla=$  wp_query->query_vars['something']; 

So I want to change the wordpress title, instead of the template name inside of wordpress panel, to something like "My template name dynamic- Website name"

I’ve found this

add_filter('pre_get_document_title', 'custom_title'); function custom_title($  title) {      return 'Test New Title'; } 

And it changes the title, however it doesn’t show the contents of the $ bla. If you echo it few lines down the code it works. I believe that is because I have to place this filter before the get_header() of the template file. Any advice?

Price change from the js table Woocommerce [closed]

I have created two additional fields to calculate the price. I now need to set this price in the cart.

This is the code that calculates the price.

jQuery(function ($  ) {  const priceList = [5, 10, 15, 20, 25, 30];  let numberFrom = 0 let numberTo = 0; let number = 0;   $  ('select[name="from"]').on("change", function(){     let optionSelected = $  ("option:selected", this);      numberFrom = optionSelected[0].index;      if(numberFrom != 0 && numberTo != 0) {         number = Math.abs(numberFrom - numberTo);         $  ('.woocommerce-Price-amount.amount bdi').text(`$  {priceList[number].toFixed(2)}zł`);     } });  $  ('select[name="to"]').on("change", function(){     let optionSelected = $  ("option:selected", this);      numberTo = optionSelected[0].index;      if(numberFrom != 0 && numberTo != 0) {         number = Math.abs(numberFrom - numberTo);         $  ('.woocommerce-Price-amount.amount bdi').text(`$  {priceList[number].toFixed(2)}zł`);     } });   }); 

I need the price taken from the table to be set for the client. Use AJAX for this?

MySQL 8.0.24 – Change transaction_isolation based on incoming session

I have a requirement for a newly added DB in MySQL instance to have READ-COMMITED as the transaction isolation level. While the rest of the DBs require the default REPEATABLE-READ.

I am trying to leverage init_connect system variable to check incoming session and based on that setting the transaction-isolation at session level.

Added below line to my.cnf and restarted the service and I can see it is reflecting post reboot, but when i logged in as test user i still see default transaction isolation which means my condition in init_connect is not working. What am i doing wrong here

init_connect = "SET @@transaction_isolation = CASE CURRENT_USER() WHEN 'test@10.X.X.X' THEN 'READ-COMMITTED' ELSE @@transaction_isolation END;" 

Thanks

How to change Gallery image url in product page ? In function.php?

My code is like

add_filter('wp_get_attachment_url', function($  url){     if(strstr($  _SERVER['HTTP_ACCEPT'], 'image/webp')!=false){         return $  url.".webp";     }else{         return $  url;     } }); 

But only the last image in Gallery changed to xxx.webp . I want to know how to change other image ….I want all of them changed to xxx.webp

I dont want use a plugin (Or if i have to …),Please HELP ,Thanks .

how to change list of some scalars into vectors?

I have a pair of equations f= {eq1,eq2} that are (x,y) dependent. I take derivative by (x) and (y) for each equation, for example,

 Grad[f, {x, y}] . {1, 1}]  

and multiply it with a Xlist. The functions are dependent on Xlist too say {{1,2,3},{2,2,4}} For some functions (say f1) my output is listed like this

 {{12},{2}}  {{12,3,4},{21,2,3}} 

The function f1 usually is

 f1={xy+x^2,xy+y^2 }   

form. For other functions like

 f2 ={x,y^2}  

or

 f3={x+4,y-2}  

the output is

{1,{21}} {1,{2,3,4}} 

for f1 and

 {3,6} 

for f2. It causing me problems for next calculations because the output format is required to be like {{},{},{}….} etc. Looks like derivative of functions such as f2 and f3 yield constant or scalar f2 = (scalar, vector) and f3 =(scalar,scalar). How do I make scalar stay as a vector? How do I turn list for example {1,{3,4,..} or {{3,2,2},3} into {{1},{3,4,..} or {{3,2,2},{3}}? I have tried a rule method but my approach did not seems to pan out correctly,

 code /. {a_,{b_}}->{{a},{b}} 

because output of size derivative vary with list of functions and Xlist.

How do I change the text content of a div for a comment validation error message?

My comment form has validation so that when a user tries to post a blank comment, it currently shows the "This field is required" message under the comment box. How do I change the message content to "Please enter your comment."? I’m guessing that the following line of code might do the trick but I don’t know how to nest HTML code in my functions.php file.

document.getElementById("comment-error").innerHTML = "Please enter your comment.";  

Any help would be most appreciated.

Alter user in Postgres and change the ownership of the user to amended user

I am doing an audit and amending usernames in our postgres database (9.6) environment.

I can amend the user to a new username via the ALTER USER name RENAME TO new_name command however I want to also amend the ownership of the user on any objects they may have to the new renamed user.

If I rename the user I am then unable to make the ownership change as the old username would no longer exist.

Is there a way round this? or would it simply be easier to create a brand new username and move the ownership to the new username and then delete the old username.

Thanks

I want to change this matlab code to Mathematica? can you help me

my code have one matrix entry and works as QR decompose method by using Givens rotation and its outputs contain 2 matrix as Q and R I want to run this code in mathematica without using Matlink package…..can you help me by rewriting this code in mathematica Language eye is the IdentityMatrix and norm(a,b) is $ \sqrt{(a^2+b^2)}$ Thank you for HELP

function [Q,R] = my_givens_QR(A) n = size(A,1);  Q=eye(n); R=A; for j=1:n for i=n:(-1):j+1 x=R(:,j); if norm([x(i-1),x(i)])>0 c=x(i-1)/norm([x(i-1),x(i)]); s=-x(i)/norm([x(i-1),x(i)]); G=eye(n); G([i-1,i],[i-1,i])=[c,s;-s,c]; R=G'*R; Q=Q*G; end end end 

How to compute the max/min surface area of a donut-shape solid generated by a revolved 2D circle, as the volume of the solid doesn’t change?

A donut shape solid is generated by revolving a circle $ (x-a)^2+y^2=b^2$ around the y-axis. $ a$ is the distance from the center of the hole of the donut to the center of the circle revolved, and $ b$ is the radius of the circle revolved. I’m trying to compute the minimized surface area and the maximized surface area (if the solid has) with the value of $ a$ and $ b$ , while the volume of the solid doesn’t change (which is $ 90\pi^2$ ). Thanks a lot if someone can help me 🙂