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 run


composer dumpautoload


And 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


Handy snippet to get current page URL on your WordPress website. It doesn’t matter if you need it on single post, page, home, category, tag, custom post type or any other WordPress template. You can use this code inside any template on your WordPress website:

Thursday, 4 May 2017

C program to find wether entered number is Even or Odd using continue.


Sunday, 30 April 2017

Adding navigation menu support to WordPress theme

While you are creating a custom WordPress theme you will that "Menus" will be dis-appear from the "Appearance" menu in dashboard of your "WordPress". It is because your theme does not have the support for WordPress menus module.

For adding this support you have add a few lines of code in your "functions.php" to call the "register_nav_menus" function, like so:

Can also check if the function exists if you desire. But if it's only for use on your own theme and you know it exists it's not really needed.


Wednesday, 26 April 2017

How to add featured image on third level of navigation?

Hello Guyz,

May, there are times when you need to show featured image in navigation of WordPress website. Here, we are sharing code for same. It, will help you to retrieve featured images for the third level of your menu. You, can make it further also or backward by doing minor tweaks in code.

If you face any issue or find it useful please comment.

Thank You,

Tuesday, 4 April 2017

Get popular tags of a category....

Put this function in functions.php of your active theme. You, can call the tags on category archive page, using shortcode [popular_post_tags] in editor or in case you want to call it using php use do_shortcode like echo do_shortcode('[popular_post_tags]');.

Please, do comment your suggestions and reviews. Thank You!

Thursday, 30 March 2017

Clean up WordPress header

Someone like to make the WordPress header as clean as possible and then reconstruct it to his own liking. The code below is excessive for removing 'WordPress inserted code'. It will clean up the header.

Wednesday, 11 January 2017

JavaScript Snippets