Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
Created May 22, 2014 17:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save thecodepoetry/e5bb6f6a0e014ae450f1 to your computer and use it in GitHub Desktop.
Save thecodepoetry/e5bb6f6a0e014ae450f1 to your computer and use it in GitHub Desktop.
Change sidebar position for woocommerce products for The7 -Mulltipurpose wordpress them
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');
@thecodepoetry
Copy link
Author

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.

@wiserweb
Copy link

wiserweb commented May 2, 2017

As of May 2, 2017 this solution is still valid.

@8p-design
Copy link

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!

@mcjefix
Copy link

mcjefix commented Mar 5, 2018

As of March 5, 2018 this solution is still valid.

@nicolabavaro
Copy link

Still valid! Thanks!

@davelln
Copy link

davelln commented Nov 30, 2020

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