hide "feature"cateory in page title

Posted in: Newspaper
Post count: 28

hey there,

The current title format of my site is “post name|category name|site name”. And now when a post is bookmarked as featured ,its page title will show as”post name|featured|site name”.While I may want some post to be featured and show in the big slide, I would like the title relect its own category name instead of “featured”.More specificly,I don’t want an extra category.

Thanks guys.

  • This topic was modified 11 years by winnieji.
Post count: 7909

Hi,

Please modify your custom code for that, so in case that you don’t want to show a specific category add a condition to not show it or you can use a plugin for that. If you don’t have basic html/css experience I suggest that you hire a professional developer to make this custom modification for you. Unfortunately we cannot offer custom work fro the moment because we work hard on the development, updates, fixes and support.

Thanks!

Post count: 28

Hi,I have the basic html knowledge,so could you pls just point the direction?

Thank you so much!

Post count: 28

the title code I used in header.php is :

<title><?php if ( is_front_page()) { bloginfo(‘name’); ?> – <?php bloginfo(‘description’); }elseif(is_single()){wp_title(”);?> | <?php $category = get_the_category();echo $category[0]->cat_name;?> | <?php bloginfo(‘name’); }else {
echo trim(wp_title(”,0));
if ( $paged >= 2 || $page >= 2 )
echo ‘ – ‘ . sprintf( __( ‘绗�%s椤�’ ), max( $paged, $page ) );
echo ‘ | ‘ ;
bloginfo(‘name’);
} ?></title>

I know adding a sentence like”If it is featured,show original cateory” or something will do the magic.Just don’t know what exactly it is:)

Post count: 6600

Hi,

Try adding a condition to the category name like this: http://screencast.com/t/7ckdObHMPNJu

Thanks

Post count: 28

Thank you Lucian,I tried your code as below,but it won’t work,the featured title will be like”POST NAME | | SITE NAME”

<title><?php if ( is_front_page()) { bloginfo(‘name’); ?> – <?php bloginfo(‘description’); }elseif(is_single()){wp_title(”);?> | <?php $category = get_the_category(); if ($category[0]->cat_name!=’Featured’) {echo $category[0]->cat_name; }
?> | <?php bloginfo(‘name’); }else {
echo trim(wp_title(”,0));
if ( $paged >= 2 || $page >= 2 )
echo ‘ – ‘ . sprintf( __( ‘第%s页’ ), max( $paged, $page ) );
echo ‘ | ‘ ;
bloginfo(‘name’);
} ?></title>

  • This reply was modified 11 years by winnieji.
Post count: 780

Hi,

unfortunately that is a wordpress issue with category permalinks. It does not allow users to select what category should appear in the permalinks. I would suggest to try a plugin. I know about this one but it’s a bit older: https://wordpress.org/plugins/hikari-category-permalink/ and I do no know if it works now but there are others.

Radu O.

Post count: 28

Thank you Radu,but it is not about the url.I am talking about the page title that’s shown in the browser.

Post count: 28

pls help,one step away:) @Lucian

Post count: 6600

Hi,

Not sure how you could do this. Basically you would need to get the main category so I suggest you try to find online a way to get the main category when more categories are set.
Sorry for the inconvenience but you need to get some to help you with this if you don’t know how to do it.

Thanks for understanding!

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.