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!!

 

Link to comment
Share on other sites

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');  }
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.