Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter('wpseo_title', 'vozrastofilter_title');
- function vozrastofilter_title($title) {
- if( is_page(352) ) {
- $age_tag = (int)$_GET['age_tag'];
- if ( $age_tag ) {
- $yoast_title = get_post_meta( get_the_ID(), '_yoast_wpseo_title', true );
- $title_period = "";
- if($age_tag == 1000) $title_period = "Ребенок-школьник";
- if($age_tag == 11) $title_period = "11 мес.";
- if($age_tag == 10) $title_period = "10 мес.";
- if($age_tag == 9) $title_period = "9 мес.";
- if($age_tag == 8) $title_period = "8 мес.";
- if($age_tag == 7) $title_period = "7 мес.";
- if($age_tag == 4) $title_period = "4-6 мес.";
- if($age_tag == 1) $title_period = "1-3 мес.";
- if($age_tag == 700) $title_period = "7 лет";
- if($age_tag == 600) $title_period = "6 лет";
- if($age_tag == 500) $title_period = "5 лет";
- if($age_tag == 400) $title_period = "4 года";
- if($age_tag == 300) $title_period = "3 года";
- if($age_tag == 200) $title_period = "2 года";
- if($age_tag == 100) $title_period = "1 год";
- $title = $yoast_title.' - '.$title_period;
- }
- }
- return $title;
- }
- add_filter( 'wpseo_metadesc', 'vozrastofilter_description', 10, 1 );
- function vozrastofilter_description($description) {
- if( is_page(352) ) {
- $age_tag = (int)$_GET['age_tag'];
- if ( $age_tag ) {
- $yoast_description = get_post_meta( get_the_ID(), '_yoast_wpseo_metadesc', true );
- $title_period = "";
- if($age_tag == 1000) $title_period = "Ребенок-школьник";
- if($age_tag == 11) $title_period = "11 мес.";
- if($age_tag == 10) $title_period = "10 мес.";
- if($age_tag == 9) $title_period = "9 мес.";
- if($age_tag == 8) $title_period = "8 мес.";
- if($age_tag == 7) $title_period = "7 мес.";
- if($age_tag == 4) $title_period = "4-6 мес.";
- if($age_tag == 1) $title_period = "1-3 мес.";
- if($age_tag == 700) $title_period = "7 лет";
- if($age_tag == 600) $title_period = "6 лет";
- if($age_tag == 500) $title_period = "5 лет";
- if($age_tag == 400) $title_period = "4 года";
- if($age_tag == 300) $title_period = "3 года";
- if($age_tag == 200) $title_period = "2 года";
- if($age_tag == 100) $title_period = "1 год";
- $description = $yoast_description.' Значение фильтра - '.$title_period;
- }
- }
- return $description;
- }
- add_filter( 'wpseo_canonical', 'vozrastofilter_canonical' );
- function vozrastofilter_canonical($url) {
- if( is_page(352) ) {
- $age_tag = (int)$_GET['age_tag'];
- $yoast_canonical = get_post_meta( get_the_ID(), '_yoast_wpseo_canonical', true );
- $url = get_permalink().'?age_tag='.$age_tag;
- }
- return $url;
- }
- add_filter( 'wpseo_next_rel_link', 'remove_rel_next_cat_mozhno' );
- function remove_rel_next_cat_mozhno($link) {
- if ( is_category(4) ) {
- $link = '';
- }
- return $link;
- }
- add_filter( 'wpseo_next_rel_link', '__return_false' );
- add_filter( 'wpseo_prev_rel_link', '__return_false' );
Add Comment
Please, Sign In to add comment