wpfor7
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Cherry Project, (several) class not exist!, site offline@sterndata
Hi,
It’s not actually about having just installed the plugin. I actually migrated from one hosting to another. There are already many projects published via this plugin. The site works everything except Cherry Projects. Unfortunately I cannot remove the plugin, because it is the only one that performs certain functions. When I first installed it, 11 months ago, I had to try several plugins and the only acceptable one was this. I wanted to simplify the description of the problem.
Thanks for your help!Forum: Developing with WordPress
In reply to: Infinite loop to delete a DOM elementHi!
The loading speed is not bad, but I wanted to know if in your opinion, usingpreg_replace()it could become even faster. In this case, is the algorithm the same?
Thanks
CheersForum: Developing with WordPress
In reply to: Infinite loop to delete a DOM element@diondesigns Thanks a lot! The link you posted was what I was looking for! I solved!
CheersForum: Developing with WordPress
In reply to: Infinite loop to delete a DOM elementHi @diondesigns! Thanks!
Your solution works, but many warnings of this type appeared:Warning: DOMDocument::loadHTML(): Tag nav invalid in Entity, line: 1086And so I tried to add this
libxml_use_internal_errors(true);before the call to loadHTML and
libxml_use_internal_errors(false);after it to suppress all warnings. And now it seems to go well.
Since I would like to be able to execute a code similar to this also on the other pages, could you kindly tell me which are the PHP commands that allow to identify a precise desired page, rather than another? I can’t find these commands within the ww.wp.xz.cn documentation.
How can I write a condition that executes the list of commands only if the current page is a precise well-identified page and not execute it for all the others?
Thanks so much!Forum: Developing with WordPress
In reply to: Infinite loop to delete a DOM elementIn fact, the infinite loop occurs only if the user is not logged in. This is not the problem. The problem is that I don’t know how, using PHP, I can change the code of the web page currently displayed on the fly. Because of me, I only know how to do this in Javascript, but it’s not safe. In fact, this modification must be done on many pages, and if every time I had to load them all, the loading time would become enormously high.
“Using the conditional filter callback” I don’t know what it is.
The shortcode cannot be applied because the template I use does not provide any access to this part of the web page. This part of the web page is completely fixed and not editable. If there were no security problems, it would be very easy to intervene via Javascript.
The author of the template has indicated to me which are the template files that manage this situation. They are 3 files in PHP.Forum: Developing with WordPress
In reply to: Infinite loop to delete a DOM elementHi, @bcworkz! It seems to me that the code is already executed only if the user is not logged in.
Forum: Developing with WordPress
In reply to: Infinite loop to delete a DOM elementI understand what you say, unfortunately I don’t know how to apply it. Could you give me more information?
ThanksForum: Developing with WordPress
In reply to: To edit DOM of HTML page if user is logged (PHP and JS)Hi!
I resolved by writing this code:// IF USER IS LOGGED if ( is_user_logged_in() ) { ?> <script> window.addEventListener('load', function() { var estrattolibro = document.getElementById("shortcode-b5afccd84b849874ca7fc0ded4bc1c9b"); estrattolibro.parentNode.removeChild(estrattolibro); } ) </script> <?php } // IF USER IS NOT LOGGED if ( !is_user_logged_in() ) { ?> <script> window.addEventListener('load', function() { var nodo = document.getElementsByClassName("has-edge is-page-flip")[0]; nodo.setAttribute("href", "https://www.mywebsite.com/prodotto/in-esclusiva-settimanale/?read-book=156"); var librocompleto = document.getElementById("shortcode-a68fa81bfb7e274873f75fbec325a170"); librocompleto.parentNode.removeChild(librocompleto); } ) </script> <?php } ?> </body> </html>bcworkz: Your help was important!
Thanks!Forum: Developing with WordPress
In reply to: To edit DOM of HTML page if user is logged (PHP and JS)Hi!
How can I hook the “wp_footer” action, execute my code from the added action callback, and run the script on the window.onload ? Is it okay what I wrote above?
Thanks!P.S. For now I have no security problems to solve.
- This reply was modified 6 years, 7 months ago by wpfor7.
Forum: Developing with WordPress
In reply to: To edit DOM of HTML page if user is logged (PHP and JS)Hi bcworkz!
thanks for your answer!
If I add the following code to the end of footer.php in child theme folder... // IF USER IS LOGGED if ( is_user_logged_in() ) { ?> <script> funzione_loggato(){ var estrattolibro = document.getElementById("shortcode-b5afccd84b849874ca7fc0ded4bc1c9b"); estrattolibro.parentNode.removeChild(estrattolibro); } </script> <?php } // IF USER IS NOT LOGGED if ( !is_user_logged_in() ) { ?> <script> funzione_non_loggato(){ var nodo = document.getElementsByClassName("has-edge is-page-flip")[0]; nodo.setAttribute("href", "https://www.mywebsite.com/prodotto/in-esclusiva-settimanale/?read-book=156"); var librocompleto = document.getElementById("shortcode-a68fa81bfb7e274873f75fbec325a170"); librocompleto.parentNode.removeChild(librocompleto); } </script> <?php } ?> </body> </html>…and I add this other code in a footer widget (inside a personalized HTML)
<script> window.onload=funzione_loggato();funzione_non_loggato(); </script>This doesn’t work. I’m not very experienced, can you explain me more simply?
Thanks!