admin管理员组文章数量:1023230
I'd like to insert text BEFORE the "tag" title.
So, I am using Categories and Tags and I when I click into one of my "tag" archives the title of the page is simply the word of the "tag" so in my example it is "New York"
What I would like to do is insert text BEFORE "New York"
I thought this would work but it doesn't:
add_filter( 'get_the_archive_title', 'custom_tag_archive_title' );
/**
* Remove archive labels.
*
* @param string $title Current archive title to be displayed.
* @return string Modified archive title to be displayed.
*/
function custom_tag_archive_title( $title ) {
if ( is_tag() ) {
$title = single_tag_title( 'Conferences In ', false );
}
return $title;
}
Now, the interesting thing is that I did the same for my categories and it works great. The function I am using is this:
add_filter( 'get_the_archive_title', 'custom_taxonomy_archive_title' );
/**
* Remove archive labels.
*
* @param string $title Current archive title to be displayed.
* @return string Modified archive title to be displayed.
*/
function custom_taxonomy_archive_title( $title ) {
if ( is_tax('us_state') ) {
$title = single_term_title( 'Conferences In ', false );
}
elseif ( is_tax('country') ) {
$title = single_term_title( 'Conferences In ', false );
}
return $title;
}
Any ideas why the "tag" (which is a regular "tag") doesn't load the text before?
Thanks for all suggestions.
I'd like to insert text BEFORE the "tag" title.
So, I am using Categories and Tags and I when I click into one of my "tag" archives the title of the page is simply the word of the "tag" so in my example it is "New York"
What I would like to do is insert text BEFORE "New York"
I thought this would work but it doesn't:
add_filter( 'get_the_archive_title', 'custom_tag_archive_title' );
/**
* Remove archive labels.
*
* @param string $title Current archive title to be displayed.
* @return string Modified archive title to be displayed.
*/
function custom_tag_archive_title( $title ) {
if ( is_tag() ) {
$title = single_tag_title( 'Conferences In ', false );
}
return $title;
}
Now, the interesting thing is that I did the same for my categories and it works great. The function I am using is this:
add_filter( 'get_the_archive_title', 'custom_taxonomy_archive_title' );
/**
* Remove archive labels.
*
* @param string $title Current archive title to be displayed.
* @return string Modified archive title to be displayed.
*/
function custom_taxonomy_archive_title( $title ) {
if ( is_tax('us_state') ) {
$title = single_term_title( 'Conferences In ', false );
}
elseif ( is_tax('country') ) {
$title = single_term_title( 'Conferences In ', false );
}
return $title;
}
Any ideas why the "tag" (which is a regular "tag") doesn't load the text before?
Thanks for all suggestions.
Share Improve this question asked May 9, 2019 at 11:51 HenryHenry 9831 gold badge8 silver badges31 bronze badges1 Answer
Reset to default 0I skipped this and figured out the best way as Pseudo CSS (I believe it is called)
body.tag .page-title:before {
content: 'Conferences In ';
}
^ this works well
I'd like to insert text BEFORE the "tag" title.
So, I am using Categories and Tags and I when I click into one of my "tag" archives the title of the page is simply the word of the "tag" so in my example it is "New York"
What I would like to do is insert text BEFORE "New York"
I thought this would work but it doesn't:
add_filter( 'get_the_archive_title', 'custom_tag_archive_title' );
/**
* Remove archive labels.
*
* @param string $title Current archive title to be displayed.
* @return string Modified archive title to be displayed.
*/
function custom_tag_archive_title( $title ) {
if ( is_tag() ) {
$title = single_tag_title( 'Conferences In ', false );
}
return $title;
}
Now, the interesting thing is that I did the same for my categories and it works great. The function I am using is this:
add_filter( 'get_the_archive_title', 'custom_taxonomy_archive_title' );
/**
* Remove archive labels.
*
* @param string $title Current archive title to be displayed.
* @return string Modified archive title to be displayed.
*/
function custom_taxonomy_archive_title( $title ) {
if ( is_tax('us_state') ) {
$title = single_term_title( 'Conferences In ', false );
}
elseif ( is_tax('country') ) {
$title = single_term_title( 'Conferences In ', false );
}
return $title;
}
Any ideas why the "tag" (which is a regular "tag") doesn't load the text before?
Thanks for all suggestions.
I'd like to insert text BEFORE the "tag" title.
So, I am using Categories and Tags and I when I click into one of my "tag" archives the title of the page is simply the word of the "tag" so in my example it is "New York"
What I would like to do is insert text BEFORE "New York"
I thought this would work but it doesn't:
add_filter( 'get_the_archive_title', 'custom_tag_archive_title' );
/**
* Remove archive labels.
*
* @param string $title Current archive title to be displayed.
* @return string Modified archive title to be displayed.
*/
function custom_tag_archive_title( $title ) {
if ( is_tag() ) {
$title = single_tag_title( 'Conferences In ', false );
}
return $title;
}
Now, the interesting thing is that I did the same for my categories and it works great. The function I am using is this:
add_filter( 'get_the_archive_title', 'custom_taxonomy_archive_title' );
/**
* Remove archive labels.
*
* @param string $title Current archive title to be displayed.
* @return string Modified archive title to be displayed.
*/
function custom_taxonomy_archive_title( $title ) {
if ( is_tax('us_state') ) {
$title = single_term_title( 'Conferences In ', false );
}
elseif ( is_tax('country') ) {
$title = single_term_title( 'Conferences In ', false );
}
return $title;
}
Any ideas why the "tag" (which is a regular "tag") doesn't load the text before?
Thanks for all suggestions.
Share Improve this question asked May 9, 2019 at 11:51 HenryHenry 9831 gold badge8 silver badges31 bronze badges1 Answer
Reset to default 0I skipped this and figured out the best way as Pseudo CSS (I believe it is called)
body.tag .page-title:before {
content: 'Conferences In ';
}
^ this works well
本文标签: Insert text BEFORE the quottagquot title
版权声明:本文标题:Insert text BEFORE the "tag" title 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745504166a2153528.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论