Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • I found that this in my function.php cause the problem. (is for a link to login / login out)

    add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
    
    function add_loginout_link( $items, $args ) {
    $user = wp_get_current_user();
       if (is_user_logged_in() && $args->theme_location == 'secondary') {
           $items .= '<li><a href="'. get_permalink( woocommerce_get_page_id( 'myaccount' ) ) . '">Bienvenue ' . $user->display_name . '</a></li>';
           $items .= '<li><a href="'. wp_logout_url( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) .'">Déconnexion</a></li>';
       }
       elseif (!is_user_logged_in() && $args->theme_location == 'secondary') {
           $items .= '<li><a href="' . get_permalink( woocommerce_get_page_id( 'myaccount' ) ) . '">Connexion</a></li>';
       }
       return $items;
    }

    edit:
    The problem was the variable $items was conflicting with another. So I change all $items to $itemsMenu.
    Thanks.

    I think I know why.
    My child theme is not extend the parent theme. I don’t know why…
    The only thing work is because I override some WooCommerce file in my child theme.

    Before I change theme on the client site, my child theme extend my parent theme.

    I have found the answer by myself.

    I was wrong, this was not the related product that I needed but upsells products. Here is the complete functional code:

    <section id="recent">
        <div class="wrapper">
            <h2>Les différents bâtons</h2>
    
            <?php
             $args = array( 'post_type' => 'product', 'meta_key' => '_featured','posts_per_page' => 15,'columns' => '3', 'meta_value' => 'yes' );
             $loop = new WP_Query( $args );?>
             <ul class="products">
             <?php while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
                <li class="product">
                    <div class="div-info">
                        <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="300px" height="300px" />'; ?>
                        <h3><?php the_title(); ?></h3>
                        <span class="price"><span class="amount"><?php echo $product->get_price_excluding_tax(); ?> $</span> Prix sans les taxes</span>
                        <a id="fiche" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                            <div class="hover-fiche"><p>Fiche complète du produit</p></div>
                        </a>
                        <a class="fichecomplete" href="<?php the_permalink(); ?>">Voir la fiche compléte du produit </a>
                    </div>
                    <?php
                        // Setup your custom query
                        $upsells = $product->get_upsells();
                        $meta_query = WC()->query->get_meta_query();
                        $args2 = array(
                            'post_type'           => 'product',
                            'ignore_sticky_posts' => 1,
                            'no_found_rows'       => 1,
                            'posts_per_page'      => 1,
                            'post__in'            => $upsells,
                            'post__not_in'        => array( $product->id ),
                            'meta_query'          => $meta_query
                        );
                        $loop2 = new WP_Query( $args2 );
                        while ( $loop2->have_posts() ) : $loop2->the_post(); ?>
    
                <a href="<?php echo get_permalink( $loop2->post->ID ) ?>" class="tooltip right tooltip-gradepro">
                    <div class="gradeprobutton">Obtenir en grade Pro</div>
                    <img src="wp-content/themes/storefront-child/images/info.png" alt="informations supplémentaires">
                    <span class="gradepro">
                        Bois de gamme *grade pro* sélectionné et confectionné dans un de nos 4 modèles. Il est seulement disponible dans notre édition spéciale pour la couleur.<br /><b>(99.99$)</b>
                    </span>
                </a>
                <?php endwhile; ?> <?php wp_reset_query(); // Remember to reset ?>
            </li>
                        <?php
                    /**
                     * woocommerce_pagination hook
                     *
                     * @hooked woocommerce_pagination - 10
                     * @hooked woocommerce_catalog_ordering - 20
                     */
                    do_action( 'woocommerce_pagination' );
                ?>
        <?php endwhile; ?>
        </ul>
        <?php wp_reset_query(); ?>
    
                <?php wp_reset_query(); ?>
        </div>
    </section>
    Forum: Plugins
    In reply to: variable products
    myriamlefebvre

    (@myriamlefebvre)

    I have add wordpress to my ftp account on my site. Nothing works here too.

Viewing 4 replies - 1 through 4 (of 4 total)