最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Get title of page containing post grid within the posts

programmeradmin0浏览0评论

I have a page containing a post grid. Within the text of these posts I want to use a shortcode to display the title of the page containing this grid. So, when my page title is "test" I want to be able to display "test" within the content of my post text in the post grid. I made this simple shortcode

function page_title_sc( ){
   return get_the_title();
}
add_shortcode( 'paginatitel', 'page_title_sc' );

but this code displays the title of the post in my grid, not the title of the page containing this grid. Is there a way to change this shortcode so it can display the page title instead of the post title?

发布评论

评论列表(0)

  1. 暂无评论