Skocz do zawartości
PL
Szukaj na Pecetowiczu
  • Utwórz konto

Usunięcie bocznego panelu z danej podstrony w WooCommerce


Rekomendowane odpowiedzi

Cześć, czy jest jakiś plugin co pozwoli mi wyłączyć pasek boczny w danej podstronie w Wordperss WooCommerce?

Odnośnik do komentarza
Udostępnij na innych stronach

Znalazłem taki kod:

add_action( 'wp', 'bbloomer_remove_sidebar_product_pages' );
 
function bbloomer_remove_sidebar_product_pages() {
if (is_product()) {
remove_action('woocommerce_sidebar','woocommerce_get_sidebar',10);
}
}

Dodaj do functions.php

10 to prawdopodobnie ID strony, możesz przetestować czy działa.

Odnośnik do komentarza
Udostępnij na innych stronach

(edytowane)

Zanim zabierzesz się do zmian w motywie, zalecam utworzenie motywu potomnego - zabezpieczenie przez utratą zmian po aktualizacji.

Edytowane przez El Profesor
Odnośnik do komentarza
Udostępnij na innych stronach

Godzinę temu, SeNioR napisał:

Znalazłem taki kod:


add_action( 'wp', 'bbloomer_remove_sidebar_product_pages' );
 
function bbloomer_remove_sidebar_product_pages() {
if (is_product()) {
remove_action('woocommerce_sidebar','woocommerce_get_sidebar',10);
}
}

Dodaj do functions.php

10 to prawdopodobnie ID strony, możesz przetestować czy działa.

Niestety kod nie działa, kiedyś był plugin, który dawał możliwość wyłączenia Sidebar'a, ale teraz nie mogę go nigdzie znaleźć. No nic, czekam na inne rozwiązania i idę sam szukać dalej. ☺️

Odnośnik do komentarza
Udostępnij na innych stronach

  • 2 tygodnie później...

Mam jeszcze takie pytanie, czy dałoby się w tym stylu Blogto usunąć panel w produktach z woocomerce lub jakiś plugin co to umożliwi?
Link do stylu: https://wordpress.org/themes/blogto/

Link do strony: https://markmoto.com.pl

Odnośnik do komentarza
Udostępnij na innych stronach

A jak wygląda plik single.php z motywu?

Odnośnik do komentarza
Udostępnij na innych stronach

21 godzin temu, El Profesor napisał:

A jak wygląda plik single.php z motywu?

Cały kod z pliku, którego napisałeś.

<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 * @since Blogto 1.0.0
 */
get_header();

# Print banner with breadcrumb and post title.
blogto_inner_banner();
?>
<section class="wrapper wrap-detail-page" id="main-content">
	<div class="container">
		<div class="row">
			<?php $class = ''; ?>
			<?php blogto_get_option( 'single_layout' ) == 'compact' ? $class = 'col-xs-12 col-sm-12 col-md-12' : $class = 'col-xs-12 col-sm-12 col-md-12'; ?>
				<div class="<?php echo $class; ?>">
					<main id="main" class="post-main-content" role="main">
						<?php
							# Loop Start
							while( have_posts() ): the_post();

								# Print posts respect to the post format
								get_template_part( 'template-parts/single/content', get_post_format() );

								# Print the author details of this post
								get_template_part( 'template-parts/single/content', 'author-detail' );

								# If comments are open or we have at least one comment, load up the comment template.
								if ( comments_open() || get_comments_number() ) :
									comments_template();
								endif;

								# Navigate the post. Next post and Previou post.
								the_post_navigation( array(
									'prev_text' => '<span class="screen-reader-text">' . esc_html__( 'Previous Post', 'blogto' ) . '</span><span class="nav-title">%title</span>',
									'next_text' => '<span class="screen-reader-text">' . esc_html__( 'Next Post', 'blogto' ) . '</span><span class="nav-title">%title</span>',
								) );

							# Loop End
							endwhile; 
						?>
					</main>
				</div>
		</div>
	</div>
</section>

<?php get_footer(); ?>
Odnośnik do komentarza
Udostępnij na innych stronach

Nie wrzuciłeś całego pliku, prawda? ☺️

Sciągnąłem ten motyw co podlinkowałeś wyżej i w głównym katalogu jest plik single.php a poniżej jego zawartość:

Spoiler

<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 * @since Blogto 1.0.0
 */
get_header();

# Print banner with breadcrumb and post title.
blogto_inner_banner();
?>
<section class="wrapper wrap-detail-page" id="main-content">
  <div class="container">
    <div class="row">
      <?php if( blogto_get_option( 'single_layout' ) == 'left' ): ?>
      <?php get_sidebar(); ?>
      <?php endif; ?>
      <?php $class = ''; ?>
      <?php blogto_get_option( 'single_layout' ) == 'compact' ? $class = 'col-xs-12 col-sm-12 col-md-8 col-md-offset-2' : $class = 'col-xs-12 col-sm-7 col-md-8'; ?>
      <div class="<?php echo $class; ?>">
        <main id="main" class="post-main-content" role="main">
          <?php
          # Loop Start
          while( have_posts() ): the_post();

          # Print posts respect to the post format
          get_template_part( 'template-parts/single/content', get_post_format() );

          # Print the author details of this post
          get_template_part( 'template-parts/single/content', 'author-detail' );

          # If comments are open or we have at least one comment, load up the comment template.
          if ( comments_open() || get_comments_number() ) :
          comments_template();
          endif;

          # Navigate the post. Next post and Previou post.
          the_post_navigation( array(
            'prev_text' => '<span class="screen-reader-text">' . esc_html__( 'Previous Post', 'blogto' ) . '</span><span class="nav-title">%title</span>',
            'next_text' => '<span class="screen-reader-text">' . esc_html__( 'Next Post', 'blogto' ) . '</span><span class="nav-title">%title</span>',
          ) );

          # Loop End
          endwhile; 
          ?>
        </main>
      </div>
      <?php if( blogto_get_option( 'single_layout' ) != 'left' && blogto_get_option( 'single_layout' ) != 'compact' ): ?>
      <?php get_sidebar(); ?>
      <?php endif; ?>
    </div>
  </div>
</section>

<?php get_footer(); ?>

 

 

Funkcja odpowiedzialna za 'kategorie produktów' w widoku, to get_sidebar();

Wystarczy przebudować ten widok i będzie tak jak chcesz.

Odnośnik do komentarza
Udostępnij na innych stronach

Ja to wyłączam w stronie panelu przy edycji produktu po prostu Full width i tyle

Odnośnik do komentarza
Udostępnij na innych stronach

Kontynuuj dyskusję

Dołącz do Pecetowicza, aby kontynuować dyskusję w tym wątku.

  • Dodaj nową pozycję...
  • Dodaj nową pozycję...