-
AuthorPosts
-
January 16, 2024 at 12:01 pm #1430240
Hello.
We have created and activated an Enfold Child on our website https://montealbertia.eus/
Everything works correctly, except that when we search for a page, article or image in the media in the WordPress administrator, it does not find the requested file. This does not happen with the normal Enfold theme.What can we do to solve it?
Thank you.
January 16, 2024 at 4:10 pm #1430719Hey aintzerga,
Thanks for the login details. If things are working as they should when the parent theme is active, then it’s likely that something you have added to the child is causing the problem. Please try to remove all customisations, then add them back one by one to see when the problem starts.
Best regards,
RikardJanuary 17, 2024 at 12:31 pm #1431273The truth is that I am not a computer expert and I have little knowledge about it.
These are the customization concepts of the Child theme:
<?php
/*
* Add your own functions here. You can also copy some of the theme functions into this file.
* WordPress will use those functions instead of the original functions then.
*/function avf_alb_supported_post_types_mod( array $supported_post_types ) {
$supported_post_types[] = ‘proyectos_ma’;
return $supported_post_types;
}
add_filter(‘avf_alb_supported_post_types’, ‘avf_alb_supported_post_types_mod’, 10, 1);function avf_metabox_layout_post_types_mod( array $supported_post_types ) {
$supported_post_types[] = ‘proyectos_ma’;
return $supported_post_types;
}
add_filter(‘avf_metabox_layout_post_types’, ‘avf_metabox_layout_post_types_mod’, 10, 1);function include_cpt_search( $query ) {
if ( $query->is_search ) {
$query->set( ‘post_type’, array( ‘post’, ‘page’, ‘proyectos_ma’ ) );
}
return $query;
}
add_filter( ‘pre_get_posts’, ‘include_cpt_search’ );WHAT COULD BE THE ERROR?
January 17, 2024 at 1:42 pm #1431286Hi,
Thank you for the update.
What happens when you remove the pre_get_posts filter or the whole include_cpt_search function? It seems to be altering the default search query.
add_filter( ‘pre_get_posts’, ‘include_cpt_search’ );
Best regards,
IsmaelJanuary 18, 2024 at 12:19 pm #1431382If we delete the code, WordPress generates this error and the website cannot be accessed:
Parse error: syntax error, unexpected end of file in /furanet/sites/montealbertia.eus/web/htdocs/wp-content/themes/enfold-child/functions.php on line 26
January 18, 2024 at 12:25 pm #1431383The child theme was created to be able to use the Enfold visual layout designer in the new custom post type: projects_ma
January 19, 2024 at 9:18 am #1431459Hi,
Thank you for the update.
Please make sure to remove the add_filter (pre_get_posts) and the include_cpt_search function altogether.
function include_cpt_search( $query ) { if ( $query->is_search ) { $query->set( ‘post_type’, array( ‘post’, ‘page’, ‘proyectos_ma’ ) ); } return $query; } add_filter( ‘pre_get_posts’, ‘include_cpt_search’ );
was created to be able to use the Enfold visual layout designer in the new custom post type: projects_ma
The filter avf_alb_supported_post_types should be enough to enable the Advance Layout Builder for the custom post type (projects_ma).
Best regards,
IsmaelJanuary 22, 2024 at 5:40 pm #1431695OK Thanks. Now is OK
January 23, 2024 at 4:45 am #1431729 -
AuthorPosts
- The topic ‘Error searching with Enfold child’ is closed to new replies.