Php 将文本字符串附加到WooCommerce产品标题

Php 将文本字符串附加到WooCommerce产品标题,php,wordpress,templates,woocommerce,string-concatenation,Php,Wordpress,Templates,Woocommerce,String Concatenation,我试图让这个字符串说:“产品名称更多信息” 我可以很好地获得产品名称部分,但如何将“更多信息”连接到此代码,以使其正确输出?我尝试的每次回显都会破坏我的站点如果您试图用字符串表示产品名称标题,那么您可以使用woocmerce\u shop\u loop\u item\u title挂钩 <div class="woocommerce-loop-product__title"><? wc_get_template('single-product/title.php');?>

我试图让这个字符串说:“产品名称更多信息”


我可以很好地获得产品名称部分,但如何将“更多信息”连接到此代码,以使其正确输出?我尝试的每次回显都会破坏我的站点

如果您试图用字符串表示产品名称标题,那么您可以使用
woocmerce\u shop\u loop\u item\u title
挂钩

<div class="woocommerce-loop-product__title"><? wc_get_template('single-product/title.php');?>

如果查看模板
single product/title.php
代码,您基本上只有以下内容:

the_title( $before, $after, $echo );
或者以更干净的方式

<div class="woocommerce-loop-product__title"><? the_title( '<h1 class="product_title entry-title">', ' More Info</h1>' ); ?>

这是最简单的方法吗?有没有一种方法可以添加现有代码而不必返回到我的functions.php进行编辑?我认为最好在不更改主题或插件的情况下将代码添加到functions.php。如果需要更改现有代码,那么您可能必须使用@LoicTheAztechow的答案。我是否在这一行中添加了另一个类来允许你想让我只在这一格里做吗?我尝试了一切,但它似乎想改变整个网站的标题文本,我不想这样。我只需要在这个非常具体的区域进行更改。我试过了,我试过了,在其他几次尝试中,似乎我就是不能让这件事按照我的意愿改变。
the_title( $before, $after, $echo );
the_title( '<h1 class="product_title entry-title">', '</h1>' );
<div class="woocommerce-loop-product__title"><? the_title( '<h1 class="product_title entry-title">', ' More Info</h1>' ); ?>
<div class="woocommerce-loop-product__title"><? the_title( '<h1 class="product_title entry-title">', ' '. __("More Info") . '</h1>' ); ?>