Support » Plugin: WooCommerce » shop page problem with wp_head injection

  • Resolved losrack

    (@carlos-jaramillo)


    Hi,

    I have some head injections for printing some meta tags. They all work well for all pages except for the shop page. This is really strange. The code is this:

      // meta description 
    add_action( 'wp_head','carlos_head_meta_page_99' ); 
    function carlos_head_meta_page_99() 
    { if (is_page('99')) { ?> 
        <meta name="description" content="Página del catálogo de productos. Taller y Joyería Brieva - Diseños y Accesorios - Tienda Online" /><?php } }
    
      // URL
    add_action( 'wp_head','carlos_head_meta_url99' ); 
    function carlos_head_meta_url99() 
    { if (is_page('99')) { ?> 
        <meta name="url" content="https://joyeriabrieva.com/tienda" />
        <?php } }

    Thanks for any ideas

Viewing 4 replies - 1 through 4 (of 4 total)
  • You dont need to use quotes with is_page (not is_page(’99’) but is_page(99) ), it is still going to work this way but may potentially cause confusion.

    And your page https://joyeriabrieva.com/tienda is not a WordPress “page”, but an archive-type page.

    losrack

    (@carlos-jaramillo)

    So what is your solution?

    The thing is this code works on any other woocommerce pages and corresponding page ID’s

    Thanks

    You could use is_shop() for all shop archive pages.

    losrack

    (@carlos-jaramillo)

    @superkot

    You have no idea how you helped me here. This made me go nuts.

    I used is_shop(). Also the best thing is that it worked only on the shop page and not the rest of woocommerce pages, which were working fine already.

    Again thanks!

    • This reply was modified 1 year, 5 months ago by  losrack.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘shop page problem with wp_head injection’ is closed to new replies.