Apna Garage
PHP, WordPress Codes
Friday, 29 June 2018
isEmpty in JavaScript
The best way to check if an object is empty is by using a utility function like the one below.
So if you have an empty object, you can check whether it is empty by using the above function.
Monday, 25 June 2018
Thursday, 2 November 2017
Create Bundle In Symfony 3.3.*
composer create-project symfony/framework-standard-edition s334 "3.3.4" bin/console generate:bundle Share across multiple apps: yes namespace: Paul\ArtBundle bundle name: PaulArtBundle Target Directory: src/Refreshed the browser and sure enough I got the class not found message. The generate:bundle command is not updating the autload section of composer.json when a new namespace is introduced. Edit composer.json and:# composer.json "autoload": { "psr-4": { "AppBundle\\": "src/AppBundle", "Paul\\": "src/Paul" }, "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] },Then runcomposer dumpautoloadAnd restart the server(maybe). That should fix the bundle class not found problem. I have not used the generate:bundle command is quite some time ever since the standard was to put everything under AppBundle so I don't know how long this has been "broken". But at least three questions in the last week or so indicates it was something recent. And by the way, when I refreshed the browser I got "Hello World" which threw me for a bit. Turns out the new bundle overrides the / route which is also sort of special. And in case anybody is wondering why this started happening, Symfony 3.2 changed from#composer.json "psr-4": { "": "src/" }, To "psr-4": { "AppBundle\\": "src/AppBundle" },You could always just change it back though I think spelling out individual namespaces might be "better". Not sure. And here is an issue with more details: https://github.com/symfony/symfony-standard/issues/1098 Looks like the maintainer favored a tiny speed improvement over breaking an existing command. Oh well. Symfony Flex is supposed to make everything great again
Saturday, 20 May 2017
Remove the anchor tag surrounding images : WordPress
If you have a page of images wrapped with links. Essentially if you want to remove the links surrounding images, but keep the image tags in tact, then here is the handy code for same.
Friday, 19 May 2017
Get current page URL : WordPress
Subscribe to:
Posts (Atom)