Using Product variations as product addons

Discussions on WooCommerce is off-topic here, but can’t resist myself answering. I faced a similar issue couple of months back and my solution was something like this. Remove the default add to cart form and variation choices in single variable product page. You can use JS or modify the template. Add custom form with checkboxes … Read more

Create page (not the post type) dynamically

You need to register a ‘rewrite endpoint’ using add_rewrite_endpoint(): <?php add_action( ‘init’, function() { add_rewrite_endpoint( ‘play’, EP_PERMALINK ); } ); Now, after flushing permalinks, in whatever template or code you’re using for your products you can check this to determine whether the /play version of the URL is being accessed: <?php if ( false !== … Read more

Encoding Method for URLs?

On a lower level, the function sanitize_title_with_dashes() converts to lowercase, replaces spaces and non-alphanumeric characters with dashes, and urlencodes whatever you pass to it. <?php echo sanitize_title_with_dashes( ‘This is my blog post’ ); // this-is-my-blog-post

Remove Default Blogroll Links via Plugin script

Haven’t tested this yet, but it should do the trick in 3x: // Get all the existing links $arr_args = array( ‘hide_invisible’ => 0 ); $arr_links = get_bookmarks( $arr_args ); // Run through the list and delete ’em foreach($arr_links as $obj_link) { wp_delete_link($obj_link->link_id); } Of course, you’d only want to do this once, and only … Read more

Error passing post_content to function

Hi @Scott B: Here’s a modified version of what you have that resolves the error (although the XPath does not match; I’m not an XPath guru so can’t help with the proper XPath syntax): add_filter(‘wp_insert_post_data’, ‘my_bold_keyword’, 10, 2 ); function my_bold_keyword( $data, $postarr ) { $myKeyword = “test 123”; $d = new DOMDocument(); $d->loadHTML($postarr[‘post_content’]); //ERROR … Read more