- This topic has 3 replies, 2 voices, and was last updated 8 years, 1 month ago by
Tom.
-
AuthorPosts
-
October 21, 2015 at 8:54 am #146257
Joseph
Hi, If i had my own archive-product.php that just loads as a normal page:
<?php
// override archive-product.php// load specific page
query_posts(‘page_id=7’);// load the page template for the current theme
include get_template_directory() . “/” . “page.php”;// stop any other woocommerce code executing
exit;
?>would this be the correct way to edit the woocommerce.php for this to work?
<?php
get_header(); ?>
>
<main id=”main” <?php generate_main_class(); ?>>
<?php do_action(‘generate_before_main_content’); ?>
<article id=”post-<?php the_ID(); ?>” <?php post_class(); ?> <?php generate_article_schema( ‘CreativeWork’ ); ?>><?php do_action( ‘generate_before_content’); ?><?php if ( function_exists( ‘woocommerce_content’ ) ) :
if ( is_singular( ‘product’ ) ) {
woocommerce_content();
}else{
//For ANY product archive.
//Product taxonomy, product search or /shop landing
woocommerce_get_template( ‘archive-product.php’ );
}
endif; ?><!– .entry-content –>
<?php do_action( ‘generate_after_content’); ?><!– .inside-article –>
</article><!– #post-## –>
<?php do_action(‘generate_after_main_content’); ?>
</main><!– #main –><!– #primary –>
<?php
do_action(‘generate_sidebars’);
get_footer();I’m having some troubles with a plugin, just wanted to know if it was the plugin or me doing these files wrong.
thanks
JoeOctober 21, 2015 at 4:08 pm #146356Tom
Lead DeveloperLead DeveloperHi there,
What’s the result of using the above template?
I can’t see anything obviously wrong.
October 22, 2015 at 1:23 am #146422Joseph
It may be a problem with the widget I’m using if this is the correct way. All it does is query the products and display them all with a filter at the top for the categories.
Works fine on GeneratePress Theme but on the main shop page obviously Woocommerce also puts the products on the page with woocommerce_content so i have them all twice.I then try to use a Child Theme and these modified files to stop woocommerce loading any products on the main shop page so it displays as a normal page so i can just use this widget but when using the files it shows the products fine in a grid and the filter works as normal but for some reason the product names and descriptions are added after the grid in separate blocks all the way down the page.
Strange that it doesn’t do that with the original theme activated.not sure if it is the widget or the files because they both work, just not with eachother.
October 22, 2015 at 9:55 am #146527Tom
Lead DeveloperLead DeveloperGeneratePress has a woocommerce.php file which you can try adjusting in your child theme – it uses woocommerce_content, so that could be why you’re having trouble.
Let me know 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.