tapiohuuhaa
Forum Replies Created
-
Forum: Plugins
In reply to: [Code Snippets] jQery code not executing“looking at the source code”.
You can see the generated code by looking the source code between HEAD tags. If all JavaScript is there and script tags are in correct order, this is not a Code Snippet issue.
You should check JavaScript and CSS by copying the code to some editor, which checks the validity of JS and CSS.
Code Snippet checks from JS just that some marks have pairs ( [],(),{},”,”” ). It checks them from JS quite reliable.
Concering CSS it works unreliable and can’t check properly { + }. That can also cause, that { + } are marked sometimes invalid also for PHP code. Fortunately Code Snippet doesn’t accept invalid PHP – BUT it saves temporary invalid PHP, which might crash your site! Don’t create backend snippets, if you don’t have checked the snippet elsewhere!
- This reply was modified 4 years, 10 months ago by tapiohuuhaa.
Forum: Plugins
In reply to: [Code Snippets] jQery code not executingI assume that you have added code by using wp_head() hook.
Have you looked the source code that all exists.
Code Snippet doesn’t thoroughly check the syntax of JavaScript.
Code Snippet in such doesn’t execute any JavaScript code. It just generates is.
If some generated JavaScript does not exist, have you activated all related snippets?
If all exist, this is not a Code Snippet issue at all except that setting priorities it affects the order of JavaScripts.Forum: Reviews
In reply to: [Code Snippets] It is not working on PHP 7.0 and higherI have used it with PHP 7.3. Problems are not related with PHP version.
The code of some snippet must be somewhat invalid.
Forum: Plugins
In reply to: [Code Snippets] Uncaught errorYou can deactivate the problematic setting by setting “active” as value “0” or just delete it.
Note also the field “scope”. Not use value “global” if you want it only to be used in front-end. Change scope as “front-end” if it has the value “global”.
If you have some other application to create PHP, you can copy the content of the snippet, fix the content and return it back to the database field. But be sure to have correct syntax.
WARNING! If you make a backup copy of a snippet, be aware that you don’t by mistake activate the used version and bacup copy of it at the same time! If they have the same function definition the backend of Code Snippet can’t handle this situation. You must you then with phpMyAdmin in order to deactivate the copy. This is very bad feature also.
Both used version and backup copy could both have valid syntax, but together the cause duplicate function definition, which will crash the site.
Forum: Plugins
In reply to: [Code Snippets] Uncaught errorNote that Code Snippet stores all data to database. If you reinstall this plugin, it does not change the database at all. You must delete the individual record with MySQL tool. I have deleted or marked active as 0 with phpMyAdmin.
“syntax error” – typical error. If you don’t have access to phpMyAdmin, never create backend snippets. Invalid code in them will crash your site. Invalid code in frontend snippet needs sometimes also phpMyAdmin in situations, where disabling of a snippet has been failed.
The main problem of this snippet is that it seems to store a temporary record into database but afterwards returns the correct version. But this process fails with all backend snippets. The system should be different. Temporary saved record should just be checked and set first time active 0. If the saved file is valid, afterward would be changed active 0 to 1. The current saving process is extremely dangerous and risky!
Forum: Plugins
In reply to: [Widget Logic] Trouble with PHPI didn’t know that I could put other PHP as a condition. $post->post_parent would be usefull also for me.
I tried to replace
$blogi=stristr($currentUrl,’/’.SITEROOT.’/blogikirjoitukset’);
with
$blogi = (is_page(‘173’) || ($post->post_parent==”173″));but that didn’t work.
Forum: Plugins
In reply to: [Widget Logic] Trouble with PHPI have always put for widget logic only a condition without if statement, commonly a function
some_function()
but of course you can use more complex conditions like
(some_function() || some_other-function())
If you put the function, the function just should return true or false on the base, where it has been called. I have been used this kind of system for setting parent page and sub-pages inside my own function
$currentUrl='https://' . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; $somevariable=stristr($currentUrl,'/some-page-name/');
Forum: Plugins
In reply to: [Widget Logic] Trouble with PHPWidget logic use just conditions. Don’t add additional PHP
If you want to create php code, put either to a code snippet of functions.php of the child theme.Forum: Reviews
In reply to: [Code Snippets] Untested … BEWARE!I have used it with latest WordPress version and it work ok. Id does have very serious problems, which might crash the site. But I have access to phpMyAdmin and I can deactive some snippet, if serious problem exists.
Forum: Plugins
In reply to: [Widget Logic] How do you exclude a page from showing a widget?No, is_page doesn’t support direct web-address.
In my proposal !showInBlogPage() is the condition.
My proposal !showInBlogPage() works, if blog page is not blog article page but other page. Blog articles has their own logic, where main page – sub-page system doesn’t exist.
Forum: Plugins
In reply to: [Widget Logic] How do you exclude a page from showing a widget?Better way to exclude a page and sub-pages of certain page is to use Widget Content,
which you can list certain page and sub-pages of certain page, where you want to exclude widget.
If you set this way, certain widget doesn’t exist is blog page and sub-pages of blog pages:
Target by URL:
https:…/blog/
https:…/blog/*Alternative you can create your own function as use it as a condition. Easiest this can be done by using Code Snippet plugin.
function showInBlogPage(){ $blog=stristr('https://' . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI'],'/your-site-name/blog'); return $blog; }
use this as condition:
!showInBlogPage()Forum: Plugins
In reply to: [Code Snippets] Your Site is Experiencing a Technical IssueThis is typical syntax error. In general those messages can ignore if they relate with frontend snippet. Code Snippet doesn’t allow to save snippet, which has invalid PHP syntax.
It seems that Code Snippet temporarily saves the invalid snippet and if it has error retrieves the working version to the frontend if working version exists. Because there is temporarily invalid frontend snippet, WordPress sends error message.
Concerning fronend snippets, there is possibility to fix the syntax error.
If you site works ok, just ignore these kinds messages and delete the e-mail.
If you get blank page, then there is real error. In many circumstances real problems relate with some serious problems in Code Snippet. In those cases the problem doesn’t relate with syntax errors but function definition problems. I have explained major problems elsewhere. Problems are serious and the author should warn about them in a fixed topic.
In general. Never create backend snippets if you don’t have phpMyAdmin opened and you can access database. If backend snippet has syntax error, Code Snippet can’t retrieve working version, because backend has been crashed.
Maybe safe mode can help in this matter and backend could be accessed even if there is a snippet, which has invalid syntax in a backend snippet.
IMO Code Snippet should create a temporary saving, where active has always value 0. After checking the syntax, it would delete the temporary saving. Then syntax error in backend snippet would not crash the backend. Then Code Snippet could retrieve working active backend snippet or set for invalid snippet active as value 0 or not save the invalid backend snippet at all in the case when there is the first time a trial to save the snippet.
Forum: Plugins
In reply to: [Breadcrumb NavXT] Change breadcrumbs for productWould it be possible to control settings with Code Snippets?
Setting fields gives some values, which work as conditions. I think that thouse could control also with code snippets by setting page related conditions. But knowing what conditions to alter, what is the format of variables. Looking at the source can find the name of the field but it is apparently a part of an array.if(is_someting() {// page related condition breadcrumb-navxt['field_name']=''; }
If code snipped has big priority, it would be read last and the value defined by the snippet will be used instead of the value defined by setting for this plugin.
Forum: Plugins
In reply to: [Code Snippets] How to disable snippet for mobile or other non-desktop?You don’t have any condition. You should wrap the add_action with a condition.
Forum: Plugins
In reply to: [Code Snippets] Can I use this plugin to paste AD code into the body code?add_filter( 'the_content', 'change_the_content',10);
That code adds content before the main content area. That doesn’t add content immediately after the BODY tag.