AngularJS and $httpBackend

I was helping out someone with their first attempt at an AngularJS website and they sent me the html and javascript file. The problem was that they used a web service to which I don’t have access so I needed a way to simulate that web service. I thought about writing my own version of the MVC web service but that seemed like overkill for what should just be a quick project. What I did find was $httpBackend which you can use to mock $http call with, the documentation for $httpBackend is here

The code is also on JSFiddle

Continue reading

WordPress 3.3.1 – Edit Meta Menu Widget

Okay, first thing I learnt while trying to set up this new website is how to edit the Meta Menu Widget in WordPress 3.3.1

One ways is to just remove the widget from Appearances > Widgets. Being that I didn’t feel like copying the links I actually wanted into a new widget I went in search of the php code that was behind the widget. I saw online references to widgets.php in the wp-includes folder but in 3.3.1 this does not contain the actual code for the Meta Widget. The php code for that widget is now located in default-widgets.php also found in the wp-includes folder. Search for the following to find the correct class:

class WP_Widget_Meta extends WP_Widget {

just below that on line 286 in default-widget.php is the function that builds the widget:

function widget( $args, $instance ) {

removing the <li>…</li> entries will remove the menu item, for example removing this line:

<li><?php wp_loginout(); ?></li>

will remove the Log out and Log in links.