Viewing 9 replies - 1 through 9 (of 9 total)
  • hannah

    (@hannahritner)

    Hey,
    There isn’t an option to add a site wide slider, sorry. You can use the feature template to add a slider to your pages. Does that work for you?

    Hannah

    I would also like to have th homepage slider on all pages. If you use feature page it seems like you have to upload slides individually for each page, rather than just choose a slide show, is that right?
    I also want the slider to show on all product pages too. Is there no way to ad it via php? I tried this method:
    https://wordpress.org/support/topic/show-homepage-slider-on-all-pages?replies=4
    but it didnt work for me either. slider not showing on any page.

    Thanks for any help you can give me.

    You can always do this through a child theme. I suggest looking at the front-page.php file. Near the top you would see the template calls for the slider you can copy that and place into the template your wanting to use for the site or use the base template which would affect every page, post and archive.

    Kadence Themes

    Hi Thanks for the quick response. I now have it (partially) working.
    I copied the slider part of the home-page.php, and added the end tags of the php:

    <?php  global $virtue;
    			if(isset($virtue['mobile_switch'])) {
    				$mobile_slider = $virtue['mobile_switch'];
    			} else {
    				$mobile_slider = '0';
    			}
    			if(isset($virtue['choose_slider'])) {
    				$slider = $virtue['choose_slider'];
    			} else {
    				$slider = 'mock_flex';
    			}
    			if($mobile_slider == '1') {
    		 		$mslider = $virtue['choose_mobile_slider'];
    				if ($mslider == "flex") {
    					get_template_part('templates/mobile_home/mobileflex', 'slider');
    				} else if ($mslider == "video") {
    					get_template_part('templates/mobile_home/mobilevideo', 'block');
    				}
    			}
    			if ($slider == "flex") {
    					get_template_part('templates/home/flex', 'slider');
    			} else if ($slider == "thumbs") {
    					get_template_part('templates/home/thumb', 'slider');
    			} else if ($slider == "fullwidth") {
    					get_template_part('templates/home/flex', 'slider-fullwidth');
    			} else if ($slider == "latest") {
    					get_template_part('templates/home/latest', 'slider');
    			} else if ($slider == "carousel") {
    					get_template_part('templates/home/carousel', 'slider');
    			} else if ($slider == "video") {
    					get_template_part('templates/home/video', 'block');
    			} else if ($slider == "mock_flex") {
    					get_template_part('templates/home/mock', 'flex');
    			}?>

    and pasted it into the page-sidebar.php and page.php templates.

    The slider now works on most pages but not all of the pages.
    Despite pasting the same code into the page-blog.php it doesnt show on the blog page. I would also like the slider to show on the shop page, but it doesnt. (woo commerce plugin), but it does show on the basket and account pages which are also generated by woocommerce. Strange!
    Any ideas please?

    Ok, so I have found that the shop page template is archive-product.php and I can add the slider code in there BUT it upsets the layout of the shop content for some reason. I’ve tried adding the code in different places within the php but it doesnt help.

    In your settings > reading if you have set a page to be the “posts” page then it would be using the home.php template not a page template. You should leave the “posts” page blank in your settings reading.
    Where are you placing the code?

    Kadence Themes

    Thank you! That has sorted the blog page 🙂
    What do I need to do to get the slider to show on the shop page? We’re using woocommerce.

    Thank you! That has sorted the blog page 🙂
    How do I get the slider to show on the shop page? We’re using woocommerce.
    WC documentation suggests that the shop page is created by archive-product.php when I copy that file into childtheme/commerce ready to add my slider code it upsets the layout of the shop page as if the margins disappear.
    I also need to know where in the file to paste the slider code.
    Here is the content of the archive-product.php

    <?php
    /**
     * The Template for displaying product archives, including the main shop page which is a post type archive
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
     * will need to copy the new files to your theme to maintain compatibility. We try to do this.
     * as little as possible, but it does happen. When this occurs the version of the template file will.
     * be bumped and the readme will list any important changes.
     *
     * @see 	    http://docs.woothemes.com/document/template-structure/
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.0.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    get_header( 'shop' ); ?>
    
    	<?php
    		/**
    		 * woocommerce_before_main_content hook.
    		 *
    		 * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
    		 * @hooked woocommerce_breadcrumb - 20
    		 */
    		do_action( 'woocommerce_before_main_content' );
    	?>
    
    		<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
    
    			<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
    
    		<?php endif; ?>
    
    		<?php
    			/**
    			 * woocommerce_archive_description hook.
    			 *
    			 * @hooked woocommerce_taxonomy_archive_description - 10
    			 * @hooked woocommerce_product_archive_description - 10
    			 */
    			do_action( 'woocommerce_archive_description' );
    		?>
    
    		<?php if ( have_posts() ) : ?>
    
    			<?php
    				/**
    				 * woocommerce_before_shop_loop hook.
    				 *
    				 * @hooked woocommerce_result_count - 20
    				 * @hooked woocommerce_catalog_ordering - 30
    				 */
    				do_action( 'woocommerce_before_shop_loop' );
    			?>
    
    			<?php woocommerce_product_loop_start(); ?>
    
    				<?php woocommerce_product_subcategories(); ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php wc_get_template_part( 'content', 'product' ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			<?php woocommerce_product_loop_end(); ?>
    
    			<?php
    				/**
    				 * woocommerce_after_shop_loop hook.
    				 *
    				 * @hooked woocommerce_pagination - 10
    				 */
    				do_action( 'woocommerce_after_shop_loop' );
    			?>
    
    		<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
    
    			<?php wc_get_template( 'loop/no-products-found.php' ); ?>
    
    		<?php endif; ?>
    
    	<?php
    		/**
    		 * woocommerce_after_main_content hook.
    		 *
    		 * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
    		 */
    		do_action( 'woocommerce_after_main_content' );
    	?>
    
    	<?php
    		/**
    		 * woocommerce_sidebar hook.
    		 *
    		 * @hooked woocommerce_get_sidebar - 10
    		 */
    		do_action( 'woocommerce_sidebar' );
    	?>
    
    <?php get_footer( 'shop' ); ?>

    thank you for your help!

    You need to copy the file from the theme not from woocommerce.

    Go into the theme and get the file.

    Kadence Themes

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How can i use slider for all pages ?’ is closed to new replies.