Viewing 3 replies - 1 through 3 (of 3 total)
  • This comes up from time to time. Try this code to modify the title:

    <?php
      // Change Shop page title
      // code goes in functions.php for your child theme
      // used for themes that use a product title for the shop page title
      add_filter('post_type_archive_title', 'shop_page_title' );
      function shop_page_title( $title ) {
        if( $title == __('Products', 'woocommerce')) {
          $shop_page_id = woocommerce_get_page_id( 'shop' );
          $page_title = get_the_title( $shop_page_id );
          return $page_title;
        }
        return $title;
      }

    Thread Starter 4090

    (@4090-1)

    I have tried this php code.

    However, I am not sure if I am coding it incorrectly. This is what I have in the child theme functions.php

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘appointment_blue_theme_css’,999);
    function appointment_blue_theme_css() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘bootstrap-style’, get_template_directory_uri() . ‘/css/bootstrap.css’ );
    wp_enqueue_style( ‘theme-menu’, get_template_directory_uri() . ‘/css/theme-menu.css’ );
    wp_enqueue_style( ‘default-css’, get_stylesheet_directory_uri().”/css/default.css” );
    wp_enqueue_style( ‘element-style’, get_template_directory_uri() . ‘/css/element.css’ );
    wp_dequeue_style(‘appointment-default’,get_template_directory_uri() .’/css/default.css’);
    }

    ?>
    <?php
    // Change Shop page title
    // code goes in functions.php for your child theme
    // used for themes that use a product title for the shop page title
    add_filter(‘post_type_archive_title’, ‘shop_page_title’ );
    function shop_page_title( $title ) {
    if( $title == __(‘Products’, ‘woocommerce’)) {
    $shop_page_id = woocommerce_get_page_id( ‘shop’ );
    $page_title = get_the_title( $shop_page_id );
    return $page_title;
    }
    return $title;
    }
    ?>

    I have also added the following code to the end of the styles.css

    .archive #intro.option1 h1.page-title span {visibility:hidden}
    .archive #intro.option1 h1.page-title:before {content:’Shop’}

    Any other ideas or have I implemented it incorrectly? Whilst I have programmed in HTML and javascript for a long time, I am new to wordpress and php.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Where am I looking for the problem? Page looks ok.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce Category Title = first product’ is closed to new replies.