Created
May 22, 2014 17:12
-
-
Save thecodepoetry/e5bb6f6a0e014ae450f1 to your computer and use it in GitHub Desktop.
Change sidebar position for woocommerce products for The7 -Mulltipurpose wordpress them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function change_sidebar_pos() { | |
$args = array ( | |
'post_type' => 'product', | |
'post_per_page' => -1 | |
); | |
query_posts( $args ); | |
while ( have_posts() ) : the_post(); | |
update_post_meta( get_the_ID(), '_dt_sidebar_position', 'left' ); | |
endwhile; | |
} | |
add_action('admin_init', 'change_sidebar_pos'); |
As of May 2, 2017 this solution is still valid.
Hi,
how do you recommend to set the default products configuration to be '_dt_sidebar_position', 'left', so that any new imported or inserted product have the same setup?
Thanks!
As of March 5, 2018 this solution is still valid.
Still valid! Thanks!
hi there, it is not working for me :S can you help me in 2020? ^^
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy the code to your functions.php and run WordPress dashboard once. Immediately remove the code after running once, the code will run each time when access something in dashboard and site may hang.
You can aslo try the same approach for other the7 specific options like widgetised footer and for other post type as well.