Cartflows get cart total discount

For one of my projects I needed the total discount of the items added in Cartflows to my cart so I could show the customer what he/she would save. I created the following function which loops over all the cart items and substracts the “custom price” from the “regular price”. The custom price is an […]

wp_get_nav_menu_items() current menu item

When displaying a menu in WordPress I sometimes find it pleasant to use the wp_get_nav_menu_items() function. This function returns only an array of menu item objects of the corresponding menu. So it allows you to build your custom menu exactly the way you want, without dealing with WordPress predefined output. However, if you would use the function wp_nav_menu() you benefit […]

Programmatically 301 redirect by url

There are times when you need to remove posts from your website and want to redirect them to another post. You can simply do this by checking the old post’s ID and set a 301 redirect to another post and keep the old post in your database. This basically gives the right result, but with larger projects […]