Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Header configuration & styling »

Pls help me change this code<title><?php bloginfo('name'); ?><?php wp_title(); ?></ti


  #1  
Old Jan 25, 2010, 01:48 PM
tobywinn
 
15 posts · Jun 2009
I have an eccommerce site - http://www.amberpumpkin.com - it has lots of products but they all have the same page titles.

I need to replace it with the code below - then it will take the product name and put it in the title - great for SEO.

I can't find the bit of code to change.

<title><?php
function oGetProductName( $meta ){
global $table_prefix;
$query = "SELECT product_id
FROM ".$table_prefix."wpsc_productmeta
WHERE meta_value = '".$meta."'";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );
$productid = $row[0];
$query = "SELECT name
FROM ".$table_prefix."product_list
WHERE id = ".$productid;
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );
$productname = $row[0];
return $productname;
}
function oGetCategoryName( $nicename ){
global $table_prefix;
$query = "SELECT name
FROM ".$table_prefix."product_categories
WHERE `nice-name` = '".$nicename."'";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );
[RETURN TO CONTENTS] ©STasticDesigns.
$categoryname = $row[0];
return $categoryname;
}
if( is_page() && trim(wp_title ('',false )) == 'Products Page' ){
$pparts = explode('/', trim($_SERVER['REQUEST_URI'],'/') );
if( $pparts[2] != '' ){
echo oGetProductName( $pparts[2] );
}
else if( $pparts[1] != '' ){
echo oGetCategoryName( $pparts[1] );
}
else{
wp_title (''); echo ' at Your Site Name';
}
}
else{ if ( is_single() ){ wp_title(''); }elseif (is_404()){ echo 'Your Site Name - 404 Error';
}elseif (is_category()) { echo single_cat_title(); echo ' at Your Site Name'; }elseif
(is_page()) {
wp_title (''); echo ' at Welsh Farm Organics'; }else{ echo 'Your Site Name'; }
}
?></title>
  #2  
Old Nov 18, 2011, 11:51 AM
brianwp
 
3 posts · Nov 2011
I know this is an old thread and looks to be resolved on the OP's site but since it comes up in the search results for "bloginfo( 'name' )" and hasn't been answered and I was trying to figure out something similar with a client's site, I thought I would answer it.

Since this code involves the title tag as it is between "<title>" and "</title>" it must be the header.php file in whatever theme you're using. For our site it is like "/blog/wp-content/themes/your_theme_name/header.php".

I'm new to hacking WordPress and was trying to figure out why the title tag was duplicated and realized it's because it has both "wp_title();" and "bloginfo( 'name' );" in the <title> tag. I commented out the bloginfo( 'name' ); (like so
PHP Code:
//bloginfo( 'name' ); 
for those who aren't programmers) and now it displays properly.

It used to say
Quote:
Mountainside Medical Blog | Online Medical Supplies NewsMountainside Medical Blog | Online Medical Supplies News
and now it just says,
Quote:
Mountainside Medical Blog | Online Medical Supplies News
as you can see at www. mountainside-medical.com/blog/ at the moment.

Now, I just need to figure out how to fix the incorrect link on the category pages like this one www. mountainside-medical.com/blog/category/diabetes-supplies/ where it says
Quote:
Posted by admin">
.

Last edited by Flynn; Jan 7, 2015 at 07:37 AM. Reason: Disabled links as requested per email

Bookmarks

Tags
ecommerce, header, page title, pho, title

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP modifying the underlying code markelshark Atahualpa 3 Wordpress theme 1 Nov 17, 2009 02:41 PM
How to insert php code into Byline JakeThePeg Post-Kicker, -Byline & -Footer 1 Aug 27, 2009 06:16 PM
placing favicon code into header.php AlbaSurf Header configuration & styling 1 Aug 26, 2009 08:55 PM
[SOLVED] No sidebar.php...where do I put the code? d_random Atahualpa 3 Wordpress theme 0 Apr 3, 2009 12:42 PM
Location for php code for SOCIABLE widget? strangelove Post-Kicker, -Byline & -Footer 1 Feb 18, 2009 06:04 PM


All times are GMT -6. The time now is 04:21 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.