Ismael,
There must be some other issue I cannot trace. All these changes have no effect on the Title.
remove_action('wp_head', 'av_theme_slug_render_title');
remove_filter('avf_title_tag', 'avia_wpseo_change_title_adjustment');
add_action('init', function() {
remove_action('wp_head', 'av_theme_slug_render_title');
remove_filter('avf_title_tag', 'avia_wpseo_change_title_adjustment');
}, 10);
function av_theme_slug_render_title_mod()
{
echo '<title>X ' . wp_get_document_title() . '</title>';
}
add_action( 'wp_head', 'av_theme_slug_render_title_mod' );
I assume you have validated this in a clean enfold install? It does not seem to work for me. I can also not trace any another plugin setting these titles. I also haven´t overwritten those templates in our child theme.
Best,
El
Strange. All of these actions produce no change – are you sure these are actually working with the latest enfold?
remove_filter(‘avf_title_tag’, ‘avia_wpseo_change_title_adjustment’, 10, 2); // no worky
add_filter(‘avf_title_tag’,’avia_new_title’);
function avia_new_title() {
$title = “X: “.get_the_title();
return $title;
}
add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
function avia_change_title_tag($title, $wptitle)
{
return “X: “.$wptitle;
}
function avia_set_title_tag()
{
return “X: “.wp_get_document_title();
}
function avia_set_title_tag()
{
return wp_get_document_title();
}
Here is their response and suggestion. Enfold doesn´t really take it into account though:
…
Thanks for reaching out.
We filter the core WP Title tag function to manage the Page Title of your page, so you’ll just need to return that in your filter.
add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
function avia_change_title_tag( $title, $wptitle )
{
return wp_get_document_title();
}
Hi,
Thank you for the inquiry.
We have checked the plugin documentation but we cannot find any reference about how it generates the page or post title and how to retrieve it. And we are not sure if the plugin is also using a filter to override the default title.
Please ask the plugin authors how the plugin generate the title and if there is a way to retrieve that value. There should be a function that we could use in combination with the avf_title_tag filter.
Best regards,
Ismael
Also tried:
remove_filter(‘avf_title_tag’, ‘avia_wpseo_change_title_adjustment’, 10, 2);
ElParticipant
Hi there,
I need to let me SEO tool (AIO SEO) handle all titles. Unfortunately your suggested way doesn´t work. I also contacted their support in order to make sure I get the right return function but also not luck.
Any ideas? I tried:
add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
function avia_change_title_tag( $title, $wptitle )
{
return wp_get_document_title();
}
As well as:
add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
function avia_change_title_tag( $title, $wptitle )
{
return $wptitle;
}
-
This topic was modified 4 years, 1 month ago by
El.
Hey acscreativenew,
Thank you for the inquiry.
Try to add this filter in the functions.php file to disable the default title filter from the theme.
remove_filter('avf_title_tag', 'avia_wpseo_change_title_adjustment', 10, 2);
And post the login details in the private field so that we could check the issue properly.
Best regards,
Ismael
Hi,
Thank you for the new login token.
We removed the custom SEO title field value and edited the avf_add_page_number_to_title function a bit. The page number is now included in the blog page title. This is the modified function.
/*Добавляет к Title и Description на страницах пагинации номера страниц "Страница - 2,3,4..."*/
if ( ! function_exists( 'avf_add_page_number_to_title' ) )
{
function avf_add_page_number_to_title( $title )
{
global $page;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
! empty ( $page ) && 1 < $page && $paged = $page;
isset($_GET['avia-element-paging']) && $paged = $_GET['avia-element-paging'];
$paged > 1 && $title .= sprintf( __( 'Page %s' ), $paged );
return $title;
}
add_filter( 'wpseo_metadesc', 'avf_add_page_number_to_title', 100, 1 );
add_filter( 'wpseo_title', 'avf_add_page_number_to_title', 100, 1 );
add_filter( 'avf_title_tag', 'avf_add_page_number_to_title', 100, 1 );
}
Best regards,
Ismael
The temporary entrance must still work for 1 day.
> I tried to remove the SEO title completely, nothing changes.
> In Enfold settings, if you remove a blog page, the title changes. But page numbers are still not added to Title and Description, as in headings, tags …
This code works great, but except for the “Blog” page.
if ( ! function_exists( ‘avf_add_page_number_to_title’ ) )
{
function avf_add_page_number_to_title( $title )
{
global $page;
$paged = get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1;
$paged = $paged ? $paged : get_query_var( ‘avia-element-paging’ );
! empty ( $page ) && 1 < $page && $paged = $page;
$paged > 1 && $title .= ‘ – ‘ . sprintf( __( ‘Page %s’ ), $paged );
return $title;
}
add_filter( ‘wpseo_metadesc’, ‘avf_add_page_number_to_title’, 100, 1 );
add_filter( ‘wpseo_title’, ‘avf_add_page_number_to_title’, 100, 1 );
add_filter( ‘avf_title_tag’, ‘avf_add_page_number_to_title’, 100, 1 );
}
Hi Stephen,
If you want to change it, you can use the avf_title_tag hook.
Here’s an example of how you can use it:
function avia_new_title() {
$title = get_bloginfo('name');
return $title;
}
add_filter('avf_title_tag','avia_new_title');
To target specific pages, you can use Conditional Tags: https://codex.wordpress.org/Conditional_Tags
Hope it helps.
Best regards,
Nikko
Hi,
Thank you for chiming in.
The theme add its own title tag in the header using the avia_set_title_tag function, and it probably overrides the plugin. If you want to override it, use the avf_title_tag filter. The function can be found in the themes\enfold\framework\php\function-set-avia-frontend.php file.
Best regards,
Ismael
Hi,
The problem is Enfold doesn’t check for a 410 status. We need to rely on the plugin which calls
do_action('wp_410_response');
on line 364 in wp-410.php ( https://plugins.trac.wordpress.org/browser/wp-410/trunk/wp-410.php#L364 ).
The wp_title() filter ( https://developer.wordpress.org/reference/hooks/wp_title/ ) which is used by Enfold to set the title tag in the head section is called before your custom 410.php template, thus you can’t add the code to your template. You could try to include the plugin code in our filter function like:
add_filter('avf_title_tag', 'avia_change_title_tag', 10, 2);
function avia_change_title_tag($title, $wptitle)
{
global $avia_config;
global $wpdb;
$table = $wpdb->prefix . '410_links';
$links = $wpdb->get_results( "SELECT gone_key, gone_regex FROM $table WHERE is_404 = 0", OBJECT_K );
$req = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$req = rawurldecode( $req );
foreach( $links as $link )
{
if( @preg_match( $link->gone_regex, $req ) )
{
$title = '410 – Gone';
break;
}
}
return $title;
}
to determine if it’s a 410 page or not. I haven’t tried to code myself but it should be a starting point. You can add it to the functions.php. This code should work without the code I posted before (do not combine both code snippets).
Best regards,
Dude
Didn’t make any difference but I’m not sure I am putting it in the right place?…
<?php
if ( !defined('ABSPATH') ){ die(); }
global $avia_config;
add_action('wp_410_response','avia_set_410_status', 10);
function avia_set_410_status()
{
global $avia_config;
$avia_config['is_410'] = true;
}
add_filter('avf_title_tag', 'avia_change_title_tag', 10, 2);
function avia_change_title_tag($title, $wptitle)
{
global $avia_config;
if(!empty($avia_config['is_410']))
{
$title = '410 – Gone';
}
return $title;
}
get_header();
echo avia_title(array('title' => __('Error 410 - Gone', 'avia_framework')));
do_action( 'ava_after_main_title' );
?>
<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
<?php
do_action('avia_410_extra');
?>
<div class='container'>
<main class='template-page content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content'));?>>
<div class="entry entry-content-wrapper clearfix" id='search-fail'>
<p class='entry-content'><strong><?php _e('This page has been removed', 'avia_framework'); ?></strong><br/>
<?php _e('Sorry, we\'ve had a tidy up and the the post you\'re looking for has been removed.<br/><br/>Maybe you want to perform a search?', 'avia_framework'); ?>
</p>
<?php
if(isset($_GET['post_type']) && $_GET['post_type'] == 'product' && function_exists('get_product_search_form'))
{get_product_search_form();}
else
{get_search_form();}
?>
<div class='hr_invisible'></div>
<section class="410_recommendation">
<p><strong><?php _e('For best search results, mind the following suggestions:', 'avia_framework'); ?></strong></p>
<ul class='borderlist-not'>
<li><?php _e('Always double check your spelling.', 'avia_framework'); ?></li>
<li><?php _e('Try similar keywords, for example: tablet instead of laptop.', 'avia_framework'); ?></li>
<li><?php _e('Try using more than one keyword.', 'avia_framework'); ?></li>
</ul>
<div class='hr_invisible'></div>
<?php
do_action('ava_after_content', '', 'error410');
?>
</section>
</div>
</main>
<?php
$avia_config['currently_viewing'] = 'page';
?>
</div>
</div>
<?php get_footer(); ?>
Hey!
You can try to use the wp_410_response action (plugin action) and the avf_title_tag filter (Enfold title filter) to customize the title tag like:
add_action('wp_410_response','avia_set_410_status', 10);
function avia_set_410_status()
{
global $avia_config;
$avia_config['is_410'] = true;
}
add_filter('avf_title_tag', 'avia_change_title_tag', 10, 2);
function avia_change_title_tag($title, $wptitle)
{
global $avia_config;
if(!empty($avia_config['is_410']))
{
$title = '410 – Gone';
}
return $title;
}
Best regards,
Peter
I am using the hook and code to dynamically change the avia title tag and it works everywhere but for the <title></title> area in the page header area. Is this a bug or is there a different, specific bit of code to target that?
add_filter('avf_title_tag', 'avia_change_title_tag', 10, 2);
function avia_change_title_tag($title, $wptitle) {
if (is_product() && has_term( 'Business Cards', 'product_cat' )){
$title = the_title().' Business Cards | '. get_bloginfo('name');
}
return $title;
}
Hi Kriesi
I am having a situation with Yoast and Enfold where, even though I changed my
Meta Description and Meta title with the Yoast tools on my homepage to manually
Homepage Title | Site Title
it still shows
SITE TITLE | HOMEPAGE TITLE
I tried adding this to my enfold-child/functions.php
add_filter(‘avf_title_tag’, ‘avia_change_title_tag’, 10, 2);
function avia_change_title_tag($title, $wptitle)
{
if(is_front_page()) {
$title = get_bloginfo(‘name’);
}
return $title;
}
Yet, still on the Google Search Results it still shows SITE TITLE: HOMEPAGE TITLE
Is there a way to fix this?
Thank you for your time.
Hey seykom,
Danke dass Ihr unser Theme verwendet.
Die Datei header.php liegt im parent theme ordner enfold.
Oder über den filter hook in enfold\framework\php\function-set-avia-frontend.php line 407:
$title = apply_filters('avf_title_tag', $title, wp_title('', false));
Hoffe, die Info hilft weiter.
LG
Günter
Hi,
Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_title_tag','avia_new_title');
function avia_new_title() {
$title = get_bloginfo('name');
return $title;
}
Best regards,
Yigit
Hey!
Can you please try adding following code to Functions.php file in Appearance > Editor
add_filter('avf_title_tag','avia_new_title');
function avia_new_title() {
$title = '';
return $title;
}
Best regards,
Yigit
Hey Marcel!
Please add following code to functions.php file in Appearance > Editor
add_filter('avf_title_tag','avia_new_title');
function avia_new_title() {
if(is_page(5)){
$title = get_bloginfo('name');
}
return $title;
}
You can also use a plugin such as Yoast to have more control over your page titles.
Regards,
Yigit
Hey DD!
1- Please try adding this code to the Quick CSS section under Enfold > General Styling or to your child themes style.css file:
#footer #simple-social-icons-2 {
margin-top: 0!important;
}
#footer #wysiwyg_widgets_widget-2 {
margin-bottom: 5px;
}
2- Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_title_tag','avia_new_title');
function avia_new_title() {
$title = get_bloginfo('name');
return $title;
}
Best regards,
Yigit
Hi,
Please try adding following code to Functions.php file in Appearance > Editor
add_filter('avf_title_tag','avia_new_title');
function avia_new_title() {
$title = '';
return $title;
}
Best regards,
Yigit
Hi there.
SEO > Title & Meta appears to be properly configured. In fact most sites just use the default settings and are not configured further. I made a chance to one site and saved the changes to see if that would solve the issue but it didn’t.
I searched all code on the site and the filter avf_title_tag is only used in the Enfold theme source code.
Hi,
Did you configure the options in the SEO > Title & Meta panel? Or use the “avf_title_tag” filter. Example:
https://kriesi.at/support/topic/meta-tag-issue/#post-502704
https://kriesi.at/support/topic/meta-tag-issue/#post-610780
If it’s still not working, please post the login details here so that we can configure the settings.
Best regards,
Ismael
Hey!
Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_title_tag','avia_new_title');
function avia_new_title() {
$title = get_bloginfo('name');
return $title;
}
Regards,
Yigit
So I want to override a bunch of Enfold’s functions, and I’m wondering if it’s possible to do this all in the child theme’s functions.php instead of having to modify Enfold’s php files. For example, if I want to change avia_set_title_tag() in function-set-avia-frontend.php:
if(!function_exists('avia_set_title_tag'))
{
/**
* generates the html page title
* @return string the html page title
*/
function avia_set_title_tag()
{
$title = get_bloginfo('name').' | ';
$title .= (is_front_page()) ? get_bloginfo('description') : wp_title('', false);
$title = apply_filters('avf_title_tag', $title, wp_title('', false));
return $title;
}
}
Since the function is declared inside of if(!function_exists('avia_set_title_tag')) am I correct in assuming that I can just write this in functions.php to override it?
function avia_set_title_tag()
{
$title = wp_title('', false);
$title = apply_filters('avf_title_tag', $title, wp_title('', false));
return $title;
}
-
This topic was modified 9 years, 8 months ago by
morecolor.
Hi!
Use following code instead
add_filter('avf_title_tag','my_new_tag_filter');
function my_new_tag_filter()
{
$title = get_bloginfo('name').' ';
$title .= (is_front_page()) ? get_bloginfo('description') : wp_title('', false);
return $title;
}
Best regards,
Yigit
Hey!
Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_title_tag','my_new_tag_filter');
function my_new_tag_filter()
{
$title = get_bloginfo('name').' - ';
$title .= (is_front_page()) ? get_bloginfo('description') : wp_title('', false);
return $title;
}
You can simply remove the dash if you would not like to display it
Regards,
Yigit
Hey!
– First, Yigit recommends to try yoast seo plugin.
If you installed the plugin, you have to modify the page title in the SEO > Title & Meta panel.
– Then Ismael says the theme handles the page title differently
I didn’t know that you installed the plugin. If the seo plugin is installed, it will override the theme’s title filter.
– And finally Vinnie says the issue is related to the settings in Yoast SEO plugin.
Sorry for the confusion. You have to activate the Force re-writing of titles option in the SEO > Title & Meta panel.
For now, we disabled the plugin’s title force rewrite so that you can use the theme’s filter:
add_action('init', 'ava_remove_seo_title_filter', 50);
function ava_remove_seo_title_filter() {
remove_filter('avf_title_tag', 'avia_wpseo_change_title_adjustment', 10, 2);
}
The site title and description is now included in the title.
Cheers!
Ismael
-
This reply was modified 9 years, 5 months ago by
Ismael.
Hey!
The theme handles the page title differently so we added a filter for it. Add this in the functions.php file if you want to include the site description in the title:
add_filter('avf_title_tag','avf_new_title');
function avf_new_title() {
if( is_front_page() || is_home() ) {
$title = get_bloginfo('name') . ' | ' . get_bloginfo('description');
}
return $title;
}
Best regards,
Ismael