Jump to content

Simple Page Title Character Removal Help Needed Please


mnybud

Recommended Posts

First and foremost I am PHP newbie so excuse the dumb question but I have been struggling with this one for hours and can not find the solution. Can someone show me how I would rewite the following wordpress code for meta tags so that it automatically strips out the character ' from the "single" page titles?

 

Example I want this title: "My Cat's Black" to be "My Cats Black"

 

This is the line I am trying to edit.....

elseif ( is_single() ) { wp_title(''); print ' | '; bloginfo('name');  }

 

here is the full piece of code...

<title><?php 
if ( is_home() ) { bloginfo('name'); print ' | '; bloginfo('description'); } 
elseif ( is_search() ) { bloginfo('name'); print ' | '; _e('Search Results', 'woothemes');  }  
elseif ( is_author() ) { bloginfo('name'); print ' | '; _e('Author Archives', 'woothemes');  }  
elseif ( is_single() ) { wp_title(''); print ' | '; bloginfo('name');  }
elseif ( is_page() ) {  bloginfo('name'); print ' | '; bloginfo('description'); }
elseif ( is_category() ) {  single_cat_title(); print ' | '; bloginfo('name');  }  
elseif ( is_month() ) {  _e('Archive', 'woothemes'); print ' | '; the_time('F'); bloginfo('name'); }
elseif (function_exists('is_tag')) { if ( is_tag() ) {  bloginfo('name'); print ' | '; _e('Tag Archive', 'woothemes'); print ' | ';  single_tag_title("", true); } } 
?></title>

 

Any help would be greatly appreciated!!

 

I actually want to replace it in the wp_title portion, how would I modify it to do that since it is using print?

 

<?php
elseif ( is_single() ) { wp_title(''); print ' | '; str_replace("'", "", bloginfo('name'));  }
?>

 

(thanks a lot for the help)

I actually want to replace it in the wp_title portion, how would I modify it to do that since it is using print?

 

<?php
elseif ( is_single() ) { wp_title(''); print ' | '; str_replace("'", "", bloginfo('name'));  }
?>

 

(thanks a lot for the help)

 

the print is merely putting the "|" in the title as a separator I think you want

 

<?php
elseif ( is_single() ) { str_replace("'", "", wp_title('')); print ' | '; bloginfo('name');  }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.