2) Line 12 muffin cups with cupcake papers.
3) In a medium bowl, sift together the flour, cocoa powder, baking powder, and salt, and set aside.
4) Cream the butter and 175g of the sugar together until pale yellow, about 1 minute.
5) Add the egg and stir until just combined. Gently add half of the flour mixture and stir until just incorporated.
6) Mix in the milk.
7) Add the remaining flour mixture and stir until combined. Set aside.
8) In a small bowl, mix together the cream cheese, remianing sugar, and vanilla. Stir in the chocolate chips and walnuts.
9) Fill prepared cupcake liners with enough chocolate batter to just cover the bottom. Add a dollop of the cream cheese filling to each, then top with remaining batter (cream cheese filling should not be visible).
10) Bake for 20 minutes. Let the cupcakes stand in the tin for 3 minutes, and then remove and allow to cool completely on a rack.
11) To make the ganache, place the chocolate, cream and espresso powder (if using) together in a heat proof bowl set over a saucepan of gently simmering water. Whisk for about 4 minutes, until the chocolate is melted and the mixture is thick. Remove from heat and leave for 5 minutes.
12)Dip each cupcake into the ganache, forming an even layer of frosting. Place in the refrigerator for about 15 minutes, to set.