Preheat oven to 350 degrees F. Line a baking sheet with parchment paper.
Using an electric mixer, beat the butter and sugar together until creamy.
Add the eggs and vanilla extract. Mix until well combined.
In a medium bowl, whisk together the cocoa powder, all purpose flour, white whole wheat flour, baking powder and salt.
Add the flour mixture to the mixing bowl and mix on low speed until combined, scraping down the sides of the bowl as needed.
Mix in the chocolate chips and nuts, if using.
Divide the dough in half. Shape each half into a ball and then use your hands to shape each ball into a log that is about 8 inches long.
Place the logs on the prepared baking sheet. Use your hands to flatten the dough logs until they are about 3/4-inch thick. Gently press the sides and ends of the logs to even them out and flatten them.
Bake for 20-25 minutes, until the center of the logs is almost firm and bounces back when touched.
Let the logs cool on the baking sheet for 30 minutes.
Use a sharp knife to cut the logs into biscotti shape, on the diagonal. Press straight down with the knife, rather than sawing.
Place the biscotti, cut side up, on the baking sheet. Bake for 12-16 more minutes, until dry. The centers of the cookies will be slightly soft and will crisp as they cool.
If you want to dip your biscotti in melted chocolate, let the cookies cool completely first. See note below.
Store biscotti in an airtight container at room temperature for 1-2 weeks or in the freezer for 3 months.