Creating Title and Meta Description Manually from custom PHP
-
I am working on a site https://www.einhorns-epic-cookies.com. I am trying to change the Title and Meta Description for the individual pages but the code shown below prevents me from dong that and the Title and Meta Description seem the same for all the pages. Any help would be gretaly appreciated.
<meta charset="<?php bloginfo('charset'); ?>" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta charset="<?php bloginfo('charset'); ?>" /> <meta property="og:type" content="website"> <?php if(is_single()) : global $post; ?> <title><?php echo WP_SITENAME; ?> | <?php single_post_title(''); ?></title> <meta property="og:site_name" content="<?php echo WP_SITENAME; ?>"/> <meta property="og:title" content="<?php single_post_title(''); ?>" /> <meta property="og:url" content="<?php the_permalink() ?>" /> <meta property="og:description" content="<?php echo htmlentities(strip_tags($post->post_content)); ?>" /> <?php if (has_post_thumbnail()) { $img_array = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID)); $og_thumb = $img_array[0]; } else { $og_thumb = TEMPLATEDIR.'/assets/images/og.jpg'; } ?> <?php elseif(is_home()): ?> <title><?php bloginfo('name'); ?> | Cookies. Comics. Unicorns.</title> <meta name="description" content="<?php echo WP_SITENAME; ?> | Cookies. Comics. Unicorns."> <meta property="og:site_name" content="<?php echo WP_SITENAME; ?> | Cookies. Comics. Unicorns."/> <meta property="og:title" content="<?php echo WP_SITENAME; ?> | Cookies. Comics. Unicorns." /> <meta property="og:url" content="<?php echo WP_HOME_URL; ?>" /> <meta property="og:description" content="<?php bloginfo('description'); ?>"> <?php $og_thumb = TEMPLATEDIR.'/assets/images/og.jpg'; ?> <?php elseif(is_post_type_archive('cookies')): ?> <title><?php bloginfo('name'); ?> | Cookies. Comics. Unicorns.</title> <meta name="description" content="Cookie delivery to your door, a space unicorn comic book in every bag!"> <meta property="og:site_name" content="<?php echo WP_SITENAME; ?> | Order Cookies Online. Cookie Delivery. Cookie Gift Boxes."/> <meta property="og:title" content="<?php echo WP_SITENAME; ?> | Order Cookies Online. Cookie Delivery. Cookie Gift Boxes." /> <meta property="og:url" content="<?php echo WP_HOME_URL; ?>/cookies/" /> <meta property="og:description" content="Cookie delivery to your door, a space unicorn comic book in every bag!"> <?php $og_thumb = TEMPLATEDIR.'/assets/images/og.jpg'; ?> <?php else : ?> <title><?php echo WP_SITENAME; ?> | | Cookies. Comics. Unicorns.</title> <meta name="description" content="<?php bloginfo('description'); ?>"> <meta property="og:site_name" content="<?php echo WP_SITENAME; ?>"/> <meta property="og:title" content="<?php echo WP_SITENAME; ?>" /> <meta property="og:url" content="<?php echo WP_HOME_URL; ?>" /> <meta property="og:description" content="<?php bloginfo('description'); ?>"> <?php $og_thumb = TEMPLATEDIR.'/assets/images/og.jpg'; ?> <?php endif; ?> <meta property="og:image" content="<?php echo $og_thumb;?>" />
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Creating Title and Meta Description Manually from custom PHP’ is closed to new replies.