• Resolved yeremyan

    (@yeremyan)


    Hi
    hooks don’t work on my website:

    aioseop_title, aioseop_description, aioseop_keywords

    even if i leave the hooks empty and return any string they don’t work
    insertion via WPCode also does not work


    check the code below

    // define the aioseop_title callback 
    add_action('aioseop_title', 'change_wordpress_seo_title');
    function change_wordpress_seo_title($title)
    {
    return 123456789;

    global $post;
    $options_themes = get_option('flamix_theme_options');
    /* $desc = preg_replace("#<$tg.*?>|</$tg>#i", "", get_field( 'product_description', $post->ID)); */
    $desc = strip_tags(get_field('product_description', $post->ID));
    $desc = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $desc);
    if (empty($title) || strcasecmp($title, get_the_title()) == 0) {
    preg_match_all("|%(.*)%|U", $options_themes['title'], $matches);
    if (in_array("title", $matches[1]) && in_array("desc", $matches[1])) {
    $title = str_replace("%title%", get_the_title(), $options_themes['title']);
    $title = str_replace("%desc%", $desc, $title);
    } elseif (in_array("title", $matches[1]))
    $title = str_replace("%title%", get_the_title(), $options_themes['title']);

    elseif (in_array("desc", $matches[1]))
    $title = str_replace("%desc%", $desc, $options_themes['title']);

    elseif (!$options_themes['title'] || empty($options_themes['title']))
    $title = get_the_title();
    else
    $title = $options_themes['title'];
    }
    return $title;
    }

    add_filter('aioseop_description', 'filter_aioseop_description', 10, 1);
    function filter_aioseop_description($aioseop_description)
    {
    global $post;

    if (empty($aioseop_description) || !$aioseop_description) {
    $options_themes = get_option('flamix_theme_options');
    /* $desc = preg_replace("#<$tg.*?>|</$tg>#i", "", get_field( 'product_description', $post->ID)); */
    $desc = strip_tags(get_field('product_description', $post->ID));
    $desc = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $desc);

    preg_match_all("|%(.*)%|U", $options_themes['desc'], $matches);
    if (in_array("title", $matches[1]) && in_array("desc", $matches[1])) {
    $aioseop_description = str_replace("%title%", get_the_title(), $options_themes['desc']);
    $aioseop_description = str_replace("%desc%", $desc, $aioseop_description);
    } elseif (in_array("title", $matches[1]))
    $aioseop_description = str_replace("%title%", get_the_title(), $options_themes['desc']);

    elseif (in_array("desc", $matches[1]))
    $aioseop_description = str_replace("%desc%", $desc, $options_themes['desc']);

    else
    $aioseop_description = $options_themes['desc'];
    }


    return $aioseop_description;
    };


    add_filter('aioseop_keywords', 'filter_aioseop_keywords', 10, 1);
    function filter_aioseop_keywords($aioseop_keywords)
    {
    global $post;
    $options_themes = get_option('flamix_theme_options');
    $desc = preg_replace("#<$tg.*?>|</$tg>#i", "", get_field('product_description', $post->ID));
    $desc = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $desc);
    if (empty($aioseop_keywords) || !$aioseop_keywords) {
    preg_match_all("|%(.*)%|U", $options_themes['keywords'], $matches);

    if (in_array("title", $matches[1]) && in_array("desc", $matches[1])) {
    $aioseop_keywords = str_replace("%title%", get_the_title(), $options_themes['keywords']);
    $aioseop_keywords = str_replace("%desc%", $desc, $aioseop_keywords);
    } elseif (in_array("title", $matches[1]))
    $aioseop_keywords = str_replace("%title%", get_the_title(), $options_themes['keywords']);

    elseif (in_array("desc", $matches[1]))
    $aioseop_keywords = str_replace("%desc%", $desc, $options_themes['keywords']);

    else
    $aioseop_keywords = $options_themes['keywords'];
    }

    return $aioseop_keywords;
    };

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.