Hi,
Could anyone advise, I cannot seem to find a solution how to run,
this code in only the product pages,
and also I need a dynamic ID for the product.
<div id=”…. script src… ?product=ID of the product.
Latest WordPress, latest code snippet plugin. Can not save any changes, because I get Error 510.
Its a very short PHP:
<?php
$utimeDatum1= mktime(0, 0, 0, 2, 10, 1934); // 2. Oktober 1934
$utimeDatum2= time (); // Jetzt
$diff= $utimeDatum2 - $utimeDatum1;
printf ("%d", ($diff / 86400));
?>
Tryed Settings > Debug > “Upgrade Database” and “Reset Chache”
I get following Errors:
Mixed Content: The page at ‘https://www.sfg-hohenems.com/wp-admin/admin.php?page=edit-snippet&id=4’ was loaded over HTTPS, but requested an insecure favicon ‘https://www.sfg-hohenems.com/wp-content/uploads/2015/11/cropped-Logo-32×32.png’. This request has been blocked; the content must be served over HTTPS.Understand this error
admin.php:1 Mixed Content: The page at ‘https://www.sfg-hohenems.com/wp-admin/admin.php?page=edit-snippet&id=4’ was loaded over HTTPS, but requested an insecure favicon ‘https://www.sfg-hohenems.com/wp-content/uploads/2015/11/cropped-Logo-192×192.png’. This request has been blocked; the content must be served over HTTPS.Understand this error
edit.js?ver=3.6.5.1:2 POST https://www.sfg-hohenems.com/wp-json/code-snippets/v1/snippets/4? Object
/wp-json/code-snippets/v1/snippets/4?:1
Failed to load resource: the server responded with a status of 510 ()Understand this error
edit.js?ver=3.6.5.1:2 POST https://www.sfg-hohenems.com/wp-json/code-snippets/v1/snippets/4? Object
/wp-json/code-snippets/v1/snippets/4?:1
Failed to load resource: the server responded with a status of 510 ()Understand this error
Any Ideas?
]]>Hey Snippets
I am trying to locate my snippet files, since I wish to edit them in a remote code editor, for more functionality and error correction. I cannot find the files, so where should I look?
Thx
]]>In the free version, these tabs are greyed out and they just link to the pro pricing page. What functionality do these extras provide over being able to create PHP snippets and embed HTML? Is there any documentation about how to use those, where/how they get embedded when created etc?
I’d be more inclined to upgrade if I knew what I was getting. I can’t see anything in the FAQs about JS/CSS snippet functionality, and the pricing page just highlights that they aren’t available in the free version.
Thanks!
]]>Hi there,
I’m getting the PHP warnings noted below. With the given warnings, how can I identify the code snippet that is causing them?
Thank you!
[15-Oct-2024 17:40:08 UTC] PHP Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 1 in /home/customer/www/mysite.com/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()'d code on line 34
[15-Oct-2024 17:40:08 UTC] PHP Warning: DOMDocument::loadHTML(): Tag xml invalid in Entity, line: 1 in /home/customer/www/mysite.com/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()'d code on line 34
]]>
I got this php error : PHP Warning: include(): Failed opening ‘wp-content/themes/flatsome/assets/css/ie-fallback.css’ for inclusion (include_path=’.:/opt/alt/php81/usr/share/pear:/opt/alt/php81/usr/share/php:/usr/share/pear:/usr/share/php’) in /home/rs3ckhw/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 4
Can someone tell me what this means and how to fix it
Thank you Danny
]]>I have a WordPress Network set-up that I use for demonstration sites I have built and also used as a staging site for new clients pages before migration. A number of the sites were returning 500 errors and when I checked, activating Code Snippets was crashing the sites. I have tried deactivating Code Snippets and I can then access all the sites but as soon as I reinstall Codes Snippets and activate it the sites all show error when trying to access the dashboard. I’m happy to supply super user credentials if required
]]>Hello we are running the lates version of code snippets: 3.6.5.1
But in the error log we are seeing constant PHP warnings about code in your plugin having PHP Deprecated warnings. Below is the error message we are seeing.
PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 248
Please help as these are filling my error log.
]]>Code Snippits – main takeaways
– used on 1m + sites
– very recently updated
– instant WHITE screen of wordpress says no – its dead.
Think this level of issue would be helpful to mention elsewhere – not just in the support forum!
Thinking about saving teams from dropping into freefall on what looks like an extremely stable plugin?
]]>Having some challenge of previous code in PHP7.4 that is not compatible in PHP 8.2 which i am trouble shooting it by switch of all the code & activated one by one. When I activated the first code (as shown below), it make the Woocommerce Checkout page (Order Summary) to keep loading & hanging there. As i am not sure what went wrong as I not a technical guy. Appreciated someone can assist me on this matter. Thank you in advance.
add_filter( ‘woocommerce_cart_item_name’, ‘ts_product_image_on_checkout’, 10, 3 );
function ts_product_image_on_checkout( $name, $cart_item, $cart_item_key ) {
/* Return if not checkout page */
if ( ! is_checkout() ) {
return $name;
}
/* Get product object */
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
/* Get product thumbnail */
$thumbnail = $_product->get_image();
/* Add wrapper to image and add some css */
$image = '<div class="ts-product-image" style="width: 52px; height: 45px; display: inline-block; padding-right: 7px; vertical-align: middle;">'
. $thumbnail .
'</div>';
/* Prepend image to name and return it */
return $image . $name;
}
]]>Hi, i’m seeing the following issue in my debug.log
[21-Sep-2024 21:35:49 UTC] PHP Warning: Attempt to read property “title” on null in /home3/gooloode/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 108
[21-Sep-2024 21:35:49 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home3/gooloode/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 108
[21-Sep-2024 21:35:52 UTC] PHP Warning: Attempt to read property “title” on null in /home3/gooloode/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 108
[21-Sep-2024 21:35:52 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home3/gooloode/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 108
Hello,
I’ve been a happy pro user for a while now, but I have a little issue.
Currently any JS?snippets?are being served from a query string address, and subsequently avoiding my cache on my server, which increases the load.
This is how it’s being served:
https://www.example.com/?code-snippets-js-snippets=footer
Is there a way to write JS files out to an actual file instead so that it can be cached. Like:
https://www.example.com/js-code-snippets.js
I can’t understand why this functionality hasn’t been added already, as that’s the standard way to do things in WordPress, or at least in my experience.
Many thanks and hear from you soon,
Paul
]]>I am facing the problems, when Siteground upgrade from PHP 7.4 to PHP 8.2. Understood the Code Snippets is compatible to PHP 8.2. But suspect the codes that create in the code snippet during PHP 7.4 may not work on PHP 8.2 which causes the incompatibility especially the Woocommerce Checkout Page which most of the code reside in. Appreciated if you can share your experience on how you convert these older code to be compatible to PHP8.2. As I m not a technical guy. Thank in advance
]]>Hi,
We are trying to update the PHP from 7.4 to 8.0 or 8.2 and it sends all our websites on our server into critical error. We were told it is the Code Snippets plugin that is causing the issue. When we deactivate the code snippets plugin the websites work again. Is there anyway you can help? Thanks!
]]>I noticed that Code Snippets had been updated once I was able to get into recovery mode. If I disable Code Snippets and Code Snippets Pro, the website will load without issue. Once they’re activated, the front end will no longer load and I get a recovery email with recovery mode link.
]]>Added this script with Location “Site Wide Body”
jQuery(document).ready(function($) {
$('img[title]').each(function() { $(this).removeAttr('title'); });
});
i use authorize.net for my payments on our website. i was able to customer the message if a client gets an error due to bank declines etc.. i am trying to write the message in english and spanish with 2 or one line break in between. however, this code isnt working for a line break, can someone guide me with the correct code
function wc_authnet_update_error_message1( $error_text, $error_messages ) {
if ( !empty( $error_messages[0]['errorCode'] ) && $error_messages[0]['errorCode'] == 2 ) {
$error_text = 'Your payment was declined. Please contact your credit card issuer to approve this transaction. Alternatively, select PayPal to pay with your card.\n\nSu pago fue rechazado. Por favor, póngase en contacto con el emisor de su tarjeta de crédito para aprobar esta transacción. Alternativamente, seleccione PayPal para pagar con su tarjeta.';
}
]]>
I made 2 simple snippets:
SnippetA:
error_log("snip AAA");
function snipA(){
error_log("snipA()");
}
snipA();
SnippetB:
error_log("snip BBB");
function snipB(){
error_log("snipB()");
}
snipB();
snipA();
After last line added call to snipA()
in SnippetB. Then it broke SnippetA.
When I return to snippetA and try to do save it tells me:
Could not create snippet. Request failed with status code 500
Any idea what is wrong? Paradoxically calling to snipA()
works. So it looks like calling functions from another snippets is OK. But then it breaks SnippetA (the one who defines function that is called from other snippet…).
Any idea what is wrong?
Is it a bug?
Will it be fixed?
Thx
]]>Hello,
I am trying to update my wordpress site to PHP 8.2 My web host (siteground is telling me that code snippets plugin is not compatibile with php 8.2 and recomended i delete it. I do not want to do this. Can you offer any solution?
Thank you
L F Clark
]]>hello – i found that in order to get the snippet edits to work, i had to issue the rocky-linux 8 command:systemctl restart php_fpm.services;
is this normal?
Hello, I’ve created a adroll HTML snippet and it exists on all pages but when testing with PixelPal extension chrome browser, it doesn’t seem to fire only on home page. Can you help me to troubleshoot this please?
Here is the link to the website: https://cutt.ly/Yev3vnTC
thank you
]]>Hi, I have 1587 lines in 7 snippets and it does not save the changes, is it a limitation or a bug?
I have done 5 clean installs with just the plugin and the code and it still does not save the changes.
Thank you very much
]]>Hello,
I created a php file, but I couldn’t find exactly where it is located, even by its name.
Please help
Thank you
PS. Sorry, bad support forum. My mistake
]]>Hi I’m getting the following server error for any page on my site:
2024/08/07 15:08:16 [error] 128425#128425: *24331 FastCGI sent in stderr: “PHP message: PHP Warning: Undefined array key 1 in /www/mysvlas_793/public/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 10PHP message: PHP Warning: Undefined array key 1 in /www/mysvlas_793/public/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 11” while reading upstream, client: 69.27.84.20, server: mysvlas.org, request: “GET /employee-resources/health-plan-tax-options/ HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php8.1-fpm-mysvlas.sock:”, host: “mysvlas.org:44233”, referrer: “https://mysvlas.org/employee-resources/retirement-plan/”
I’ve removed the header and footer, as well as the three snippets I’m using and I still get the error.
The only way I’ve found to remove the error, is by deactivating the plugin.
Any advice?
Thanks,
Glenn
]]>hello and good day dear developers
well i love what i see – one question though: can i run this on wordpress and perform this on a overpass-turbo.eu – (API-Frontend)
and show the results in a table!? – in a widget – is this possible?
[out:csv(::id,::type,::lon,::lat,amenity,name,"addr:postcode","addr:city","addr:street","addr:housenumber","contact:website",website,"contact:email")]
[timeout:600];
rel[boundary=administrative][admin_level=6][name="München"] -> .city;
(nwr[amenity=hospital]name;
nwr[amenity=school]name;
nwr[amenity=church]name;
nwr[amenity=childcare]name;
nwr[amenity=nursing_home]name;);
out center;
can i do this – run this in WordPress – and fnally show the results in a table!? – in a widget – is this possible?
]]>Good Day,
We need a code snippet that will allow us to move the ID column from last to first.
The above will allow site Admins to find specific snippets a lot faster. Long term, we recommend incorporating this change into your plugin.
Thank you!
]]>This might be counter intuitive to your incentive to use pro version, but is there a master list of commonly used types of code snippets used by wordpress admins?
For example, insert tracking code in head, add css, increase memory, limit revisions, autosave interval, disable feed, etc, etc…
We see on your website you have a few examples… like GA
If you have a repository of commonly requested or used snippets that would be pretty useful. I’m sure there is plenty of good examples here in the forum here but frankly wp org forum is horrible to search/find stuff easily.
]]>In previous versions of this plugin, we remember seeing more pre-made snippets examples for CSS, script, etc… it looks like the list of available example snippets is ever-shrinking.
Is it just me or is this the case for other users?
]]>Hi there,
I just have a plugin that has an annoying banner. Normally it is very easy to eliminate such things using the code snippets. However there is an error and I cannot activate the snipped. I found this code from a forum and a lot of people had good results with it. However I cannot apply it. I have also no idea what the error is and how to fix this. The snipped code for the PHP would be something like this:
function eliminar_marca_seraphinite() { ?> <script> document.addEventListener(“DOMContentLoaded”, function() { var enlacesConImagen = document.querySelectorAll(‘a img[alt=”Seraphinite Accelerator”]’); enlacesConImagen.forEach(function(imagen) { var enlace = imagen.closest(‘a’); if (enlace) { enlace.style.display = “none”; } }); }); </script> <?php } add_action(‘wp_footer’, ‘eliminar_marca_seraphinite’);
Hey Snippets
Below each snippet on a mulltisite, there is the option to check:
Allow this snippet to be activated on individual sites on the network
When I save it goes unchecked again. Now having a snippet active on one site and not on another makes a lot of sense, but it does not seem to work here. So how do I get to activate deactivate a snippet per site, while managing it globally?
]]>