Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: display & link taxonomies on single-*.php #3289
    Jan Gruchow
    Member

    Thanks for the hint, but i think it’s still not the right solution for me.

    i have set the rewrite for the taxonomies to “false”, because i want my categories with URL-Parameters.
    If i use the the slug and/or with-front for the rewrite, i automatically active the pretty links (what i don’t want). And there is also no way to set the “/products/”.

    Or am i missing something?

    in reply to: display & link taxonomies on single-*.php #3284
    Jan Gruchow
    Member

    Hi

    i have set the rewrite slug. But this is for the singe-product-url, not?

    I have set:

    
    ,'has_archive' => 'products'
    		,'rewrite' => array(
    		  'slug' => 'product'
    		)
    

    That way, URLs like:
    domain.com/products/a-product-list
    domain.com/product/a-single-product
    and it works fine.

    I only dont know, how i can get the get_term_link-function to link to the specific product-archive and not just the generic archive…
    The Link:
    domain.com/?color=blue
    is also displaying the right product, but i uses the default archive-template. I that to use my specific archive-product-template so i need them to link to domain.com/PRODUCTS/?color=blue

    in reply to: display & link taxonomies on single-*.php #3195
    Jan Gruchow
    Member

    I have one mor question: As i wrote in my example, i use
    <a href="' . get_term_link( $term->slug, 'product_color' ) . '">' . $term->name . '</a>
    to generate my links back to the archive. these links look like this:
    domain.com/?color=blue

    My problem ist, that i want to use the product-archive-template. The links should look like domain.com/products/?color=blue

    is there a easy way to change the links, so the custom-post-type-slug is added? I couldn’t find anything in the wp-codex.

    in reply to: display & link taxonomies on single-*.php #3192
    Jan Gruchow
    Member

    that’s true.

    since i’am not good in programming, it is hard for me to find the right things in the WP-codex-reference, especially if i don’t even know what to look for.

    in reply to: display & link taxonomies on single-*.php #3190
    Jan Gruchow
    Member

    Hi

    perfekt, that was what i was looking for.

    For interested readers, here is the full snipped i use:

    $product_colors = wp_get_object_terms( $post->ID,  'product_color' );
    						if ( ! empty( $product_colors ) ) {
    							if ( ! is_wp_error( $product_colors ) ) {
    								echo '<ul>';
    									foreach( $product_colors as $term ) {
    										echo '<li><a href="' . get_term_link( $term->slug, 'product_color' ) . '">' . $term->name . '</a></li>'; 
    									}
    								echo '</ul>';
    							}
    						}
Viewing 5 posts - 1 through 5 (of 5 total)