Insert term when page is published – avoid duplicates after edits

I suggest post status transitions that runs only when your set conditions are met. Example: add_action( ‘transition_post_status’, ‘add_awesome_terms’, 10, 3 ); function add_awesome_terms( $new_status, $old_status, $post ) { // only run when it’s a page, new status is publish and old status isn’t publish if ( $post->post_type == ‘page’ && $new_status == ‘publish’ && $old_status … Read more

Understanding WP

The reason hooks ( Filters and Actions ) are in these templates is specifically so you don’t need to copy the templates into your theme folder. The biggest issue with copying WooCommerce templates into your theme is that often time whenever WooCommerce updates they also update the templates. Then you’ll need to bring your changes … Read more

Genesis: How to add content after aside and before the content-sidebar wrap

If you look in lib/structure/layout.php, towards the bottom, you’ll see: add_action( ‘genesis_after_content’, ‘genesis_get_sidebar’ ); /** * Output the sidebar.php file if layout allows for it. * * @since 0.2.0 * * @uses genesis_site_layout() Return the site layout for different contexts. */ function genesis_get_sidebar() { $site_layout = genesis_site_layout(); //* Don’t load sidebar on pages that don’t … Read more

Custom Thickbox Broken on Dashboard Page?

After digging into this for a bit, it looks like there’s a number of pages where WordPress ends up changing the behavior of the default thickbox implementation — this includes both javascript changes, as well as custom style rules. You can see an example of this here #File: wp-admin/js/media-upload.js // thickbox settings var tb_position; (function($) … Read more

Using hooks with extra parameters

Since do_action( ‘woocommerce_before_single_product_summary’ ); doesn’t have any additional input arguments like: do_action( ‘woocommerce_before_single_product_summary’, $args1, $args2, $args3 ); then your action callback will always be called without any input arguments. function my_own_function () { // … } So you will have to get it by other means: e.g. through functions, classes or by tapping values from … Read more