Split post or page content in two or more columns

If you’re using the Block Editor, use Core’s column blocks. If you’re using the Classic Editor, make shortcodes for Bootstrap’s rows and columns. When you enter content, you can then just enter [row] [column large=”6″]First column content[/column] [column large=”6″]Second column content[/column] [/row] (You may find prebuilt shortcodes out in the wild since this is a … Read more

Create category after theme setup and modify the default one

You can use wp_update_term to modify terms (even the default uncategorized) and wp_insert_term to update existing terms. Here is a basic example that should get you there. function add_category(){ // Update Uncategorized Category (1) wp_update_term( 1, ‘category’, array( ‘name’ => ‘New Category Name’, ‘slug’ => ‘new-category-slug’ ) ); // Insert New Category if(!term_exists(‘another-category’)) { wp_insert_term( … Read more

WooCommerce REST API AJAX Auth – 401 response

First off, the WooCommerce REST API documentation is available here and you should check it out. Secondly, the examples below are using the /wc/v3/products/categories (“List all product categories“) endpoint. And here’s a proper way to authenticate your request using OAuth — it always works when authenticating over HTTPS and it is the only accepted option … Read more

How to update post content of all posts with tag?

You can loop through each of the $posts and update the post_content with update_post_meta. <?php foreach( $posts as $p ) { update_post_meta( $p->ID, ‘post_content’, ‘YOURCUSTOMEDITS’ ); } ?> edit: if you want to use wp_update_post, it’d look like this: <?php foreach( $posts as $p ) { $my_post = array( ‘ID’ => $p->ID, ‘post_content’ => ‘New … Read more