Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #728709

    creatorofstuff
    Participant

    Hi –

    I’m still very new to X theme and I am really loving it!

    1.
    I managed to set up a page containing a product grid (using Essential Grid) to replace my WooCommerce shop page. The only way I could figure out how to make this happen (and avoid WooCommerce from showing their version of the products under my grid) is to not assign a shop page in the WooCommerce settings. I then found some php code that allows you to set a custom URL for the button on the cart page that says “return to shop”, and I have successfully set that to go to my page with the Essential Grid.

    However, my next problem is that when looking at any of the individual product pages, there are breadcrumbs (see screenshot), which I would like to keep, but the shop link leads nowhere. I would like to assign my custom URL to that link, but have no idea how.

    Here’s an example page: http://test1.sassypantsdesign.com/shop/just-for-fun/crockpot/

    Can you help?

    2.
    I have another question. Is there a way to a second (very subtle) header section that would contain small, unobtrusive links to the cart and wishlist, even in the form of icons, so that no matter where you are on the site you could access those things?

    Thank you!

    #728915

    Rad
    Moderator

    Hi there,

    Thanks for posting in.

    Those are possible 🙂 , the original code for breadcrumbs is this

    function x_breadcrumbs() {
    
        if ( x_get_option( 'x_breadcrumb_display' ) ) {
    
          GLOBAL $post;
    
          $is_ltr         = ! is_rtl();
          $stack          = x_get_stack();
          $delimiter      = x_get_breadcrumb_delimiter();
          $home_text      = x_get_breadcrumb_home_text();
          $home_link      = home_url();
          $current_before = x_get_breadcrumb_current_before();
          $current_after  = x_get_breadcrumb_current_after();
          $page_title     = get_the_title();
          $blog_title     = get_the_title( get_option( 'page_for_posts', true ) );
    
          if ( ! is_404() ) {
            $post_parent = $post->post_parent;
          } else {
            $post_parent = '';
          }
    
          if ( X_WOOCOMMERCE_IS_ACTIVE ) {
            $shop_url   = x_get_shop_link();
            $shop_title = x_get_option( 'x_' . $stack . '_shop_title' );
            $shop_link  = '<a href="'. $shop_url .'">' . $shop_title . '</a>';
          }
    
          echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
    
            if ( is_home() ) {
    
              echo $current_before . $blog_title . $current_after;
    
            } elseif ( is_category() ) {
    
              $the_cat = get_category( get_query_var( 'cat' ), false );
              if ( $the_cat->parent != 0 ) echo get_category_parents( $the_cat->parent, TRUE, $delimiter );
              echo $current_before . single_cat_title( '', false ) . $current_after;
    
            } elseif ( x_is_product_category() ) {
    
              if ( $is_ltr ) {
                echo $shop_link . $delimiter . $current_before . single_cat_title( '', false ) . $current_after;
              } else {
                echo $current_before . single_cat_title( '', false ) . $current_after . $delimiter . $shop_link;
              }
    
            } elseif ( x_is_product_tag() ) {
    
              if ( $is_ltr ) {
                echo $shop_link . $delimiter . $current_before . single_tag_title( '', false ) . $current_after;
              } else {
                echo $current_before . single_tag_title( '', false ) . $current_after . $delimiter . $shop_link;
              }
    
            } elseif ( is_search() ) {
    
              echo $current_before . __( 'Search Results for ', '__x__' ) . '“' . get_search_query() . '”' . $current_after;
    
            } elseif ( is_singular( 'post' ) ) {
    
              if ( get_option( 'page_for_posts' ) == is_front_page() ) {
                echo $current_before . $page_title . $current_after;
              } else {
                if ( $is_ltr ) {
                  echo '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
                } else {
                  echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>';
                }
              }
    
            } elseif ( x_is_portfolio() ) {
    
              echo $current_before . get_the_title() . $current_after;
    
            } elseif ( x_is_portfolio_item() ) {
    
              $link  = x_get_parent_portfolio_link();
              $title = x_get_parent_portfolio_title();
    
              if ( $is_ltr ) {
                echo '<a href="' . $link . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
              } else {
                echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . $link . '">' . $title . '</a>';
              }
    
            } elseif ( x_is_product() ) {
    
              if ( $is_ltr ) {
                echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
              } else {
                echo $current_before . $page_title . $current_after . $delimiter . $shop_link;
              }
    
            } elseif ( x_is_buddypress() ) {
    
              if ( bp_is_group() ) {
                echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option( 'x_buddypress_groups_title' ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
              } elseif ( bp_is_user() ) {
                echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option( 'x_buddypress_members_title' ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
              } else {
                echo $current_before . x_buddypress_get_the_title() . $current_after;
              }
    
            } elseif ( x_is_bbpress() ) {
    
              remove_filter( 'bbp_no_breadcrumb', '__return_true' );
    
              if ( bbp_is_forum_archive() ) {
                echo $current_before . bbp_get_forum_archive_title() . $current_after;
              } else {
                echo bbp_get_breadcrumb();
              }
    
              add_filter( 'bbp_no_breadcrumb', '__return_true' );
    
            } elseif ( is_page() && ! $post_parent ) {
    
              echo $current_before . $page_title . $current_after;
    
            } elseif ( is_page() && $post_parent ) {
    
              $parent_id   = $post_parent;
              $breadcrumbs = array();
    
              if ( is_rtl() ) {
                echo $current_before . $page_title . $current_after . $delimiter;
              }
    
              while ( $parent_id ) {
                $page          = get_page( $parent_id );
                $breadcrumbs[] = '<a href="' . get_permalink( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>';
                $parent_id     = $page->post_parent;
              }
    
              if ( $is_ltr ) {
                $breadcrumbs = array_reverse( $breadcrumbs );
              }
    
              for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) {
                echo $breadcrumbs[$i];
                if ( $i != count( $breadcrumbs ) -1 ) echo $delimiter;
              }
    
              if ( $is_ltr ) {
                echo $delimiter . $current_before . $page_title . $current_after;
              }
    
            } elseif ( is_tag() ) {
    
              echo $current_before . single_tag_title( '', false ) . $current_after;
    
            } elseif ( is_author() ) {
    
              GLOBAL $author;
              $userdata = get_userdata( $author );
              echo $current_before . __( 'Posts by ', '__x__' ) . '“' . $userdata->display_name . $current_after . '”';
    
            } elseif ( is_404() ) {
    
              echo $current_before . __( '404 (Page Not Found)', '__x__' ) . $current_after;
    
            } elseif ( is_archive() ) {
    
              if ( x_is_shop() ) {
                echo $current_before . $shop_title . $current_after;
              } else {
                echo $current_before . __( 'Archives ', '__x__' ) . $current_after;
              }
    
            }
    
          echo '</div>';
    
        }
    
      }

    Which can be placed at your child theme’s functions.php with your changes.

    For example, change this:

    if ( X_WOOCOMMERCE_IS_ACTIVE ) {
            $shop_url   = x_get_shop_link();
            $shop_title = x_get_option( 'x_' . $stack . '_shop_title' );
            $shop_link  = '<a href="'. $shop_url .'">' . $shop_title . '</a>';
          }

    to this:

    if ( X_WOOCOMMERCE_IS_ACTIVE ) {
            $shop_url   = home_url().'/store-house/';
            $shop_title = __( 'Store House', '__x__' );
            $shop_link  = '<a href="'. $shop_url .'">' . $shop_title . '</a>';
          }

    And you can include your icons for cart and wishlist. Just make sure to use echo to avoid issues 🙂

    Like this,

    echo '<a href="'.home_url().'/link-to-wishlist">'.do_shortcode('[x_icon type="list"]
    ').'</a> | <a href="'.home_url().'/link-to-cart">'.do_shortcode('[x_icon type="shopping-cart"]
    ').'</a>';

    Cheers!

    #728929

    creatorofstuff
    Participant

    Hi and thank you so much for your help. 🙂 I’m still feeling so fortunate to have found X theme with its great support and ease of use.

    May I ask another question about including the cart and wishlist icons? I put the code you provided in my child’s functions.php file. Obviously, I need to do more than just that, but not having a clue about php, I’m not sure what I should change. Currently, I see the following shortcode in the header – [x_icon type=”list”] | [x_icon type=”shopping-cart”] (see screenshot) – which is a great start, but no icons, and the links don’t lead to the wishlist or the cart. What do I do next?

    Also, I notice that the icons for the social media have shifted up inside their circles. See screenshot.

    Thanks again!

    #729029

    creatorofstuff
    Participant

    One more thing. I just discovered that I can’t access my pages through Cornerstone with that code in functions.php so I had to remove it.

    I had put it at the bottom. Is that a problem?

    Thanks.

    #729130

    Rad
    Moderator

    Hi there,

    You have to put it within the breadcrumbs code I provided above. Just before these two closing brackets:

       }
    
      }

    The codes only use the sample links and you have to change it to your preferred URL. It depends on what your shop URL is using. What’s your wishlist and cart URL?

    It can be like this,

    echo '<a href="'.home_url().'/wishlist/">'.do_shortcode('[x_icon type="list"]
    ').'</a> | <a href="'.home_url().'/cart/">'.do_shortcode('[x_icon type="shopping-cart"]
    ').'</a>';

    Thanks!

    #729605

    creatorofstuff
    Participant

    Oh, I see. So since my wishlist and cart urls are my home url /wishlist/ and /cart/, shouldn’t the code above work just the way it is?

    Right now, I don’t see the icons at all in the header.

    I also have another question: Which is better (or worse, depending on your point of view) – to create a page that is your shop page (that is not assigned in WooCommerce settings) and then point the breadcrumbs to it (like we are talking about above), or simply hide the WooCommerce shop content in the page (so you only see the product Essential Grid), and go ahead and assign that page as the shop in the WooCommerce settings? Since I started this thread, I found out how to do that, and it appears to work ok. I want to create the least amount of problems with WooCommerce that I can.

    In the meantime, for now, I have the shop content hidden, but I have the breadcrumb code in my functions. php file (child) in its original form (without any url changes), but with the last bit of code above in it so I can get those cart / wishlist links. But again, I can’t see them, so I don’t know if the links would work or not.

    Thanks again!

    #729883

    Rad
    Moderator

    Hi there,

    It should work as I tested locally, though I’m not really sure how it’s implemented. Would you mind providing your site’s admin and FTP login credentials in private reply?

    Custom shop page is possible, but maybe need a lot of configuration as woocommerce best works on their native setup.

    I need to check your setup first 🙂

    Thanks.

    #729903

    creatorofstuff
    Participant
    This reply has been marked as private.
    #730096

    Rad
    Moderator

    Hi there,

    Yes it’s much better but it’s not limited to that setup

    I checked and you didn’t apply the suggested changes from #729883. And it’s only active to the page that has the breadcrumb. Like this, http://test1.sassypantsdesign.com/shop/

    The icons are visible on my end but you just need to change their URL as suggested.

    Thanks.

    #730136

    creatorofstuff
    Participant

    I’m confused. In #729883 I don’t see any suggestions. ? Sorry to be dense. I’m just not understanding this very well. 🙁

    #730227

    Rad
    Moderator

    Hi there,

    Ah wrong number, my bad 🙂

    It’s under #729130, please update your code to this.

    echo '<a href="'.home_url().'/wishlist/">'.do_shortcode('[x_icon type="list"]
    ').'</a> | <a href="'.home_url().'/cart/">'.do_shortcode('[x_icon type="shopping-cart"]
    ').'</a>';

    Thanks!

    #730949

    creatorofstuff
    Participant

    Ok, thanks. I’m sure this is my fault, but as soon as I put that code in, my site disappeared and all I got was server errors. I had to ftp the functions.php file to my desktop and edit out that code to get back up and running.

    I put the code above between the last 2 } }. As I said earlier, I don’t understand php, so I feel like I’m flying blind. 🙁

    #731130

    Rupok
    Member

    Hi there,

    Thanks for updating. If you feel uncomfortable then you could seek help from a developer to assist you on this.

    Cheers!

    #731142

    creatorofstuff
    Participant

    Or perhaps you could tell me why using that code brought down my site? I copied and pasted it straight from your post…

    #731147

    creatorofstuff
    Participant

    Let’s start over. All I want is for you to tell me how to get a link to the shopping cart on the top of every page, please. Can we do that? (I have discovered that the wishlist doesn’t seem to be compatible with Essential Grid anyway so I might have to put that on hold, although I’d like to know how to put that link in, too for future reference.

    I’m a little confused as to why this is not an easy option in X theme. If you use it with WooCommerce, then your customers need access to their cart from every page.