universalius
Forum Replies Created
-
Thanks Dave. I will try trough there.
Kind regards
Mads
Sure, I am using storefront with woocommerce. I am not sure what you mean about creating the same header.php file, since the woocommerce header.php cannot be overwritten. Unfortunately. But I have been overwriting my header.php for the storefront theme.
…I should point out that the below code you gave me, IS WORKING for other no woocommerce related pages. It’s only my product page which is struggling.
<?php if ( is_front_page() && is_home() ) { // Default homepage } elseif ( is_front_page() ) { // static homepage echo do_shortcode("[metaslider id=123]"); // Replace 123 with the slider ID to display on the homepage } elseif ( is_home() ) { // blog page } elseif ( is_page('page-slug') ) { // page with slug page-slug echo do_shortcode("[metaslider id=123]"); // Replace page-slug and 123 with your specific page } elseif ( is_page('another-page-slug','or-this-page','Or by page title') ) { // page with slug page-slug echo do_shortcode("[metaslider id=123]"); // You can add as many other pages as you like } ?>
Hi Dave. Thanks for the code. As you pointed out, the problem is more related to the use of a different header.php file for woocommerce. Its placed inside /themes/inc/structure/header.php, but it seems like this file cannot be override from a child header. Is there actually a way to make slider appear on the storefron/woocommerce product page?
Kind regards
There is still no slider showing on other pages than the frontpage. I made sure my permalinks was ok and I am using “page_id=5 for my product page. THe stylesheet is the same, with the same header-file. It seems very strange. Can you see any errors in the header.php here? Is there a way that i can use the functions.php for pasting the slider code instead?
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div id=”content”>
*
* @package storefront
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?> <?php storefront_html_tag_schema(); ?>>
<head>
<meta charset=”<?php bloginfo( ‘charset’ ); ?>”>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”profile” href=”https://gmpg.org/xfn/11″>
<link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>”><?php wp_head(); ?>
</head><body <?php body_class(); ?>>
<div id=”page” class=”hfeed site”>
<?php _e( ‘Skip to content’, ‘storefront’ ); ?><?php
do_action( ‘storefront_before_header’ ); ?><header id=”masthead” class=”site-header” role=”banner” <?php if ( get_header_image() != ” ) { echo ‘style=”background-image: url(‘ . esc_url( get_header_image() ) . ‘);”‘; } ?>>
<div class=”col-full”><?php
/**
* @hooked storefront_social_icons – 10
* @hooked storefront_site_branding – 20
* @hooked storefront_secondary_navigation – 30
* @hooked storefront_product_search – 40
* @hooked storefront_primary_navigation – 50
* @hooked storefront_header_cart – 60
*/
do_action( ‘storefront_header’ ); ?></div>
</header><!– #masthead –>
<?phpif ( is_front_page() && is_home() ) {
// Default homepage
} elseif ( is_front_page() ) {
// static homepage
echo do_shortcode(“[metaslider id=30]”); // Replace 123 with the slider ID to display on the homepage
} elseif ( is_home() ) {
// blog page
} elseif ( is_page(‘page_id=5’) ) {
// page with slug page-slug
echo do_shortcode(“[metaslider id=228]”); // Replace page-slug and 123 with your specific page
} elseif ( is_page(‘page_id=5’) ) {
// page with slug page-slug
echo do_shortcode(“[metaslider id=228]”); // You can add as many other pages as you like
}?>
<?php
/**
* @hooked storefront_header_widget_region – 10
*/
do_action( ‘storefront_before_content’ ); ?><div id=”content” class=”site-content”>
<div class=”col-full”><?php
/**
* @hooked woocommerce_breadcrumb – 10
*/
do_action( ‘storefront_content_top’ ); ?>Hi Dave. I have tried with the code above and onto different places of my header.php, but unfortunately there is no slider showing. No output at all.
Any other adeas?
The first part of the code, does work for my frontpage, but the elseif statements dont go through. I have even tried using: is_page(‘page_id=5’)
Have you got an idea whats wrong?
Hi Matcha. Thanks for the code, but it only seem to work for my frontpage. I assume the slug-page, is what I define in wordpress backend, inside Pages > “quick edit” specific page > “Slug” name?s
I then pasted the slug name into the code as seen below. However, the metaslider id=174 slider is not showing under my Product page. Can you tell why?
——————–
<?phpif ( is_front_page() && is_home() ) {
// Default homepage
} elseif ( is_front_page() ) {
// static homepage
echo do_shortcode(“[metaslider id=30]”); // Replace 123 with the slider ID to display on the homepage
} elseif ( is_home() ) {
// blog page
} elseif ( is_page(‘siloprodukter’) ) {
// page with slug page-slug
echo do_shortcode(“[metaslider id=174]”); // Replace page-slug and 123 with your specific page
} elseif ( is_page(‘another-page-slug’,’or-this-page’,’Or by page title’) ) {
// page with slug page-slug
echo do_shortcode(“[metaslider id=123]”); // You can add as many other pages as you like
} ?>
————–Kind regards!