maikunari
Member
Posted 9 months ago #
I am trying to create a custom title tag for a page that is using custom post types.
What I'd like to have show in the title tag on the single page is:
<title>Postname | Custom Field:manufacturer | Taxonomy Category Name | Sitename</title>
I'm using the all in one seo plugin, I'm willing to change to a different plugin (platinum seo, yoast seo, etc) if this format can be created using them.
Any help or suggestions would be greatly appreciated!
maikunari
Member
Posted 1 month ago #
Here's what I ended up doing:
<title><?php
if (is_page('inventory')) {
wp_title( '' );
// inventory page custom title tag
//$title_tag = get_post_meta($post->ID, 'title', true);
// if ($title_tag) { echo $title_tag; }
}
global $page, $paged;
if (!is_page('inventory')) {
wp_title( '' );
}
// manufacturer custom field
$manufacturer = get_post_meta($post->ID, 'manufacturer', true);
if ($manufacturer) { echo ' ' . $manufacturer; }
// category
$categories= wp_get_object_terms($post->ID, 'division');
echo ' ' . $categories[0]->name;
// Add the blog name.
?> | <?php bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s', 'ms_base' ), max( $paged, $page ) );
?></title>