Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About JacobSeated

  • Rank

Profile Information

  • Gender
  1. Wordpress websites can be very difficult to optimize. But this depends on what theme you are using. Some theme developers have no idea what they are doing and just load all their CSS in one file, using extremely inefficient selectors. I have a client that asked me to optimize his site, and what I basically established was that little could be done. He is relying on external JavaScript files, such chat widgets, Analytics, and Google Maps. Such things tend to slow down a site a lot. Luckily they typically load asynchronously, so users will not notice it much. The pagespeed tool might
  2. Just a few tips if you are coding vanilla PHP. As others have said, you can create "pretty URLs" with mod_rewrite; But a better way to go about it would be to point all requests to PHP, for non-existent files, since it is much easier to prettify your URLs from PHP than it is with the horrific syntax of .htaccess. Here is an example, for .htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.*$ / [QSA] Then, from your index.php file: $parsed_url = parse_url($_SERVER['REQUEST_URI']); $routes = [ '/^\/(blog)\/([a-z0-
  3. You do not need a database at all. In fact, it is sometimes faster to not use a database, since it takes extra time to establish a database connection (unless it is hosted on the same server). I already tried this. The code is placed on GitHub under Apache license, maybe you can use it in your project. It only uses build-in features of PHP and gd library. Available here: https://github.com/beamtic/php-photo-gallery The project has not been updated for awhile, but still got some features planned, including a Wordpress plugin.
  4. In my experience, .htaccess (HTTP based authentication) is actually pretty bad, because the htaccess syntax is so exotic that even experienced developers sometimes struggle to figure it out. But, I often use it on client test-sites to easily prevent access and indexing in search engines. For my personal projects, I do much prefer to just redirect all requests to PHP, even for files that exist. This is because I just find it much easier to do what I need from PHP. In a purely PHP based app, you could configure your VHOST like this: RewriteEngine on RewriteRule ^.*$ index.php [L,Q
  5. That makes sense, thanks. I am now wondering if I should use preg_replace_callback or if it is safe to use addslashes. Guess I have to read up on those.
  6. I recently fixed a bug in my own website involving preg_replace, the thing is, each time I was editing an article in the front-end, preg_replace would be called on the HTML to replace certain HTML elements. What I suspect is that preg_replace has a bug that causes it to remove certain characters from the replacement string, leading to corruption of the output. Obviously only the HTML (haystack) should be modified, and the replacement string dropped in place of the needle, without modifying it in any way. This is not what happens if the replacement string contains backslashes. I have tr
  7. Hallo again, it turns out I was on a completely wrong track. If the Theme is object orientated, then it may have something like this as the top of each PHP class: if ( ! class_exists( 'TravShortcodes' ) ) : If that is the case, then it will only apply the parent class if it has not already been included. This means that you should just copy the file over to the child theme folder, and then include it from your functions.php: include_once get_stylesheet_directory_uri() . 'shortcodes.php'; This way you can easily modify any aspect of the parent that you want. It is imp
  8. I am making some progress in debugging this. Of course I did not mean "filter", as I am trying to override an existing shortcode. Anyway, I managed to verify that the shortcode has been added. I noticed the parent theme is using the init hook to add shortcodes. Then I tried print_r($shortcode_tags) again after using the init hook in my child theme, with a priority of 20, and I was finally able to verify that the shortcode is loaded. I.e.: add_action('init', 'replace_parent_theme_features', 20); function replace_parent_theme_features() { global $shortcode_tags; print_r($shortcode
  9. Hallo PHP geeks I need to override a parent-theme shortcode in Travelo from a child theme; I can edit the parent theme files just fine, but when I try to override the shortcode function from the child theme, nothing seems to happen, regardless of which hook I use to do so. I can tell that my filter function (add_new_child_shortcodes) is called, because when I echo directly from the filter, I do get my output. This fact indicates that the remove_shortcode function is called at the wrong time, and the parent function is never removed. From experimenting I know that the child-theme func
  10. On second look, this pre-configured box is not usable to me, since I need to learn to use Bitnami as well, and the paths are also non-standard, so I have no idea where to find the files I need to edit. An old fashioned LAMP install is just so much easier to work with for me. I wasted a lot of time trying to just get it to work with a domain name instead of the bare IP address. Guess that settles my doubts.. Will go for the latest version, with a manually installed Elasticsearch. Strange that I find this much easier than all this auto-installer stuff...
  11. Hallo people, this forum has been a help and inspiration before, so lets see about this one.. I am in the situation that I promised my boss to try and learn Magento, possibly with the aim to help out with development in the future. Now I just depleted my mental energy from trying to get the Elasticsearch Service, as offered by AWS, to work. I was unable to connect from my EC2 instance (even with the WAN IP approved in the security group). Then I noticed today that AWS has a pre-configured 2.3 Magento option for Lightsail — which is really tempting for me at this point — but th
  12. I own a website/blog where I write about different technical subjects, mainly web-development and coding. No reason to post it here, since I am not trying to advertise. Over the years I have observed some really weird and interesting things that people will do relating to my site. One time, someone took my entire website and placed it in an iframe. The site that did this was total spam. Never found out why or what they wished to accomplish by doing it. Luckily I have not had major problems with plagiarism yet, but I do have scrapers stealing my content and posting it together with spa
  13. I used h1's in my section elements for a while a few years back, on my tutorial site, without noticing any negative effect on my traffic. I changed back to h2-h6+section when it was made known that some assistive tech did not support it yet, and also the document outline go messed up since browsers also did not support it. I still hope that it is implemented, but I guess I have no real use for it right now. Interesting you actually tried doing that and it resulted in a 400 error. I was wondering about how to test that.
  14. I think those SEO plugins tend to cause more confusion than they add value. I have personally never used them, and I do not care if some of my title tags are too long, duplicated, or if my descriptions are too short. If some of my descriptions are short, then it is probably intentionally, and I do not want notifications about it. Having said that, chances are that you can enter in: https://example.com./ With a "dot" in front of the slash, this is also a useful trick to circumvent certain cookie-walls on websites. I think very few websites seem to normalize such requests, since develo
  15. Ahh, it seems PHP is using "**" instead of "^" for some reason. https://www.php.net/manual/en/language.operators.arithmetic.php Somehow that slipped past me. Thanks anyway though 🙂
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.