@snackmaster I am sorry to hear about the issue you’re experiencing.
To fix it, try editing the Astrid theme’s functions.php file to find this line:
$single_toggle = get_post_meta( $post->ID, '_astrid_single_header_shortcode', true );
Replace it with:
if ( is_singular() ) {
$single_toggle = get_post_meta( $post->ID, '_astrid_single_header_shortcode', true );
}
Hope that helps.
Regards,
Kharis
Thread Starter
grafis
(@snackmaster)
Appreciate the help! After updating the functions file the error on line 269 is gone but I have a new one on line 276 – Undefined variable $single_toggle in /var/www/domain.com/public_html/wp-content/themes/astrid/functions.php on line 276
/**
* Header image check
*/
function astrid_has_header() {
$front_header = get_theme_mod('front_header_type' ,'image');
$site_header = get_theme_mod('site_header_type', 'nothing');
global $post;
if ( !is_404() || !is_search() ) {
if ( is_singular() ) {
$single_toggle = get_post_meta( $post->ID, '_astrid_single_header_shortcode', true );
}
} else {
$single_toggle = false;
}
if ($single_toggle != '') {
return 'has-single';
} else {
if ( get_header_image() && ( $front_header == 'image' && is_front_page() ) || ( $site_header == 'image' && !is_front_page() ) ) {
return 'has-header';
} elseif ( ($front_header == 'shortcode' && is_front_page()) || ($site_header == 'shortcode' && !is_front_page()) ) {
return 'has-shortcode';
} elseif ( ($front_header == 'video' && is_front_page()) || ($site_header == 'video' && !is_front_page()) ) {
return 'has-video';
}
}
}
-
This reply was modified 2 years, 11 months ago by grafis.
-
This reply was modified 2 years, 11 months ago by grafis.
Thread Starter
grafis
(@snackmaster)
Anyone else experience this issue? It’s an endless stream in my error log.
@kharisblank fix posted above worked for the original error but created a new one.
I am sorry for the delay @snackmaster.
Try adding this line right after the function opening.
$single_toggle = false;
So the function will look like this:
/**
* Header image check
*/
function astrid_has_header() {
$single_toggle = false;
$front_header = get_theme_mod('front_header_type' ,'image');
$site_header = get_theme_mod('site_header_type', 'nothing');
global $post;
if ( !is_404() || !is_search() ) {
if ( is_singular() ) {
$single_toggle = get_post_meta( $post->ID, '_astrid_single_header_shortcode', true );
}
} else {
$single_toggle = false;
}
if ($single_toggle != '') {
return 'has-single';
} else {
if ( get_header_image() && ( $front_header == 'image' && is_front_page() ) || ( $site_header == 'image' && !is_front_page() ) ) {
return 'has-header';
} elseif ( ($front_header == 'shortcode' && is_front_page()) || ($site_header == 'shortcode' && !is_front_page()) ) {
return 'has-shortcode';
} elseif ( ($front_header == 'video' && is_front_page()) || ($site_header == 'video' && !is_front_page()) ) {
return 'has-video';
}
}
}
Hope that helps.
Regards,
Kharis
Thread Starter
grafis
(@snackmaster)
@kharisblank – Thank you! That worked perfectly!
You’re welcome @snackmaster!
Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.
Regards,
Kharis