the_title函数在Wordpress中返回字符串而不是回显

时间:2018-10-08 12:27:16

标签: php wordpress

在Wordpress中,如何更改回显标题以返回字符串<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="img1" class="image" data-id="1">Image 1</div> <div id="img2" class="image hide-pic" data-id="2">Image 2</div> <div id="img3" class="image hide-pic" data-id="3">Image 3</div> <div id="img4" class="image hide-pic" data-id="4">Image 4</div> <div id="img5" class="image hide-pic" data-id="5">Image 5</div> <button id="btnStart" type="button">Start</button> <button id="btnStop" type="button">Stop</button>的{​​{1}}函数?

我正在尝试:

the_title()

1 个答案:

答案 0 :(得分:1)

两种方式:

使用get_the_title()功能。它可用于检索帖子标题。它以可选的Post ID或WP_Post对象作为参数。

prod_name,ref_date,total_sales,payment_received,payment_not_received
prod_a,2018-01-01,100,30,70
prod_b,2018-10-01,50,10,40
prod_c,2018-10-02,10,0,50

OR

the_title()函数中将第三个参数df.pivot_table(df, values=['total_sales','payment_received','payment_not_received'], index = ['prod_name'], columns = 'ref_date') 设置为false。默认情况下,$title = get_the_title(); 函数回显标题。第三个参数可用于将echo设置为false,并返回标题:

$echo