Add meta tags: description and canonical
-
Hi,Thomas!
It has turned out awry, but works ??
screenshot:
https://image.prntscr.com/image/0c184c86c90a4fdb8d77851d2c7d578a.png
https://image.prntscr.com/image/324ad9a63a1a4fb18bfa8fc0b9436fdd.pngIn file add forum.php
add_action("wp_head", array($this, 'wp_head_meta_description'), 1); add_action("wp_head", array($this, 'wp_head_meta_canonical'), 1);
function wp_head_meta_description() { if ($this->current_thread) { echo '<meta name="description" content="'.esc_html($this->cut_string(stripslashes($this->get_name($this->current_thread, $this->table_threads)), 160)).'" />'; } else{ echo '<meta name="description" content="'.get_bloginfo('description').'" />'; } } function wp_head_meta_canonical() { if ($this->current_thread) { $str='<link rel="canonical" href="'.$this->get_link($this->current_thread, $this->links->topic, ($this->current_page + 1)).'" />'; $lit = "#038;"; $str = str_replace($lit, "", $str); echo $str; } else{ echo '<!-- wp_head_meta_canonical -->'; } }
You can replace?
name=”description” content=”From of the first post” />rel=”canonical” href=”There is a variant easier to specify the link?” />
@asgaros thanks for a wonderful plugin!
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Add meta tags: description and canonical’ is closed to new replies.