Tagged: echo, enfold, single-event.php, theeventscalendar, Tribe
-
AuthorPosts
-
August 31, 2016 at 9:13 pm #680326
Hi,
I’d like to edit the single-event template for Tribe The Events Calendar, and have found the other forum posts that show how Enfold overrides the Events Calendar single-event.php template. So even though Tribe provides a way to do this, since Enfold overrides this the only solution that I’ve been able to find on this forum is to just turn off the Enfold override, which also loses all styling for the all theeventscalendar templates.
https://kriesi.at/support/topic/enfold-3-0-and-tribe-events-calendar-3-8/So, I’m now trying to edit the Enfold version of the single-event template. I found it and made a copy in my child theme but its not affecting the output. Can you provide a way for my updated version of single-event.php, located in ‘my-child-theme/config-events-calendar/views/’ to override the version located in the Enfold parent theme?
Thanks in advance!
September 5, 2016 at 8:33 am #681984Hey psstudiosinc,4
Thank you for using Enfold.
Please follow the solution here: https://kriesi.at/support/topic/sidebar-not-visible-after-updating-the-events-calendar-to-4-2-5/#post-679786
Replace the value $redirect with the name of the template and adjust the $file directory.
Best regards,
IsmaelSeptember 6, 2016 at 7:41 pm #682828Hey Ismael,
Thank you, this works. It now uses the template located in the child theme, so I can edit it. However, it also loses several divs in the process and as a consequence, loses much of the styling. The divs that are lost appear to be from Enfold. See image.
I’ve copied the complete template from the parent theme exactly. Why is this part of the markup being lost when using the template in the child theme?
September 10, 2016 at 8:53 pm #684577Hi,
can you show us on the frontend what is missing for you? nothing should be missing if you use a child theme. Make sure to check out this: http://kriesi.at/documentation/enfold/using-a-child-theme/
Best regards,
AndySeptember 13, 2016 at 12:41 am #685433Hi,
Here is a screenshot of the same event, child theme on the left, parent theme on the right. See above for a code view of the missing divs.
Note that I followed Ismael’s advice for forcing the use of the Enfolds’ version of the theeventcalendar single-event.php template but copied the child theme using the following script in my functions file:
add_action('after_setup_theme', function() { if(is_child_theme()) remove_action('tribe_events_template', 'avia_events_tempalte_paths', 10, 2); }); add_action('tribe_events_template', 'avia_events_template_paths_mod', 10, 2); function avia_events_template_paths_mod($file, $template) { $redirect = array('single-event.php'); if(in_array($template, $redirect)) { $file = get_stylesheet_directory() . "/config-events-calendar/views/".$template; } return $file; }
This works but I lose the divs and styling…
September 13, 2016 at 1:08 pm #685720Hi,
Would you mind posting us a screenshot/mockup of what you would like to achieve? You can upload the screenshot to imgur.com or dropbox and share the link here :)
Best regards,
AndySeptember 13, 2016 at 7:06 pm #685975Andy,
This is the finished page using the child theme, styled as desired:
FYI, the only thing I’m trying to change is the image size that is being used in the single-event.php template from theeventscalendar. That template is being overridden by Enfold – I’m attempting to override the enfold parent version of it in my child theme. When I do, the output is missing several enclosing divs, documented above.
September 14, 2016 at 12:02 pm #686295Hi,
you can find all image sizes Enfold creates here.
However, WordPress is cropping images by default when uploading them and if you want to control this behavior you can use a plugin like this: https://wordpress.org/plugins/simple-image-sizes
I hope this will help :).Best regards,
AndySeptember 15, 2016 at 10:40 pm #687142Thanks for your response. Yes. I understand image sizes in WordPress and Enfold. Sorry if I seem frustrated, but I don’t think you are understanding the issue. I’m trying to update a template file with a different image size and am running into a problem when doing so. Sorry if its not clear to you, but could you please re-read this thread from the top? Then, please ask any questions for clarification.
Thanks in advance.
September 24, 2016 at 5:23 am #691070Hi,
I’m very sorry for the delay and confusion. Did you include the default-template.php file in the child theme? Please replace the code in the functions.php file with the following:
add_action('after_setup_theme', function() { if(is_child_theme()) remove_action('tribe_events_template', 'avia_events_tempalte_paths', 10, 2); }); add_action('tribe_events_template', 'avia_events_template_paths_mod', 10, 2); function avia_events_template_paths_mod($file, $template) { $redirect = array('default-template.php', 'single-event.php'); if(in_array($template, $redirect)) { $file = get_stylesheet_directory() . "/tribe-events/views/".$template; } return $file; }
Make sure that the default-template.php and single-events.php file is inside the tribe-events/views folder.
Best regards,
IsmaelFebruary 22, 2017 at 7:22 am #750283Hey, thanks for this! I’ve been trying for days to override that default template and this solved it.
I have run into a rather curious problem, though. It seems that the page content is being pushed below the pop-out navigation on iPhone rather than behind. This only happens on pages where I add my echo shortcode php statement to add a secondary menu.
February 28, 2017 at 7:46 am #752755February 28, 2017 at 10:08 am #752813Sure thing.
March 1, 2017 at 6:36 am #753435Hey!
What are the modifications that you added in those files? The sections are outside the wrap_all or main container that’s why the issue is happening. It’s probably an extra container added in your modification.
Best regards,
IsmaelMarch 1, 2017 at 8:44 am #753516Ismael,
Thanks for the quick response!
Here are a couple screenshots of the code.
Here is before I added the code.
And this is after
And here is the code for the new header
<?php if ( !defined( 'ABSPATH' ) ) { die(); } global $avia_config; $style = $avia_config[ 'box_class' ]; $responsive = avia_get_option( 'responsive_active' ) != "disabled" ? "responsive" : "fixed_layout"; $blank = isset( $avia_config[ 'template' ] ) ? $avia_config[ 'template' ] : ""; $av_lightbox = avia_get_option( 'lightbox_active' ) != "disabled" ? 'av-default-lightbox' : 'av-custom-lightbox'; $preloader = avia_get_option( 'preloader' ) == "preloader" ? 'av-preloader-active av-preloader-enabled' : 'av-preloader-disabled'; $sidebar_styling = avia_get_option( 'sidebar_styling' ); $filterable_classes = avia_header_class_filter( avia_header_class_string() ); ?> <!DOCTYPE html> <html <?php language_attributes(); ?> class=" <?php echo "html_{$style} ".$responsive." ".$preloader." ".$av_lightbox." ".$filterable_classes ?> "> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=Om5o09g53k"> <link rel="icon" type="image/png" href="/favicon-32x32.png?v=Om5o09g53k" sizes="32x32"> <link rel="icon" type="image/png" href="/favicon-16x16.png?v=Om5o09g53k" sizes="16x16"> <link rel="manifest" href="/manifest.json?v=Om5o09g53k"> <link rel="mask-icon" href="/safari-pinned-tab.svg?v=Om5o09g53k" color="#5bbad5"> <link rel="shortcut icon" href="/favicon.ico?v=Om5o09g53k"> <meta name="apple-mobile-web-app-title" content="GracePoint"> <meta name="application-name" content="GracePoint"> <meta name="theme-color" content="#212a2f"> <?php /* * outputs a rel=follow or nofollow tag to circumvent google duplicate content for archives * located in framework/php/function-set-avia-frontend.php */ if ( function_exists( 'avia_set_follow' ) ) { echo avia_set_follow(); } ?> <!-- mobile setting --> <?php if ( strpos( $responsive, 'responsive' ) !== false )echo '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'; ?> <!-- Scripts/CSS and wp_head hook --> <?php /* Always have wp_head() just before the closing </head> * tag of your theme, or you will break many plugins, which * generally use this hook to add elements to <head> such * as styles, scripts, and meta tags. */ wp_head(); ?> </head> <?php flush(); ?> <body id="top" <?php body_class($style. " ".$avia_config[ 'font_stack']. " ".$blank. " ".$sidebar_styling); avia_markup_helper(array( 'context'=> 'body')); ?>> <?php if("av-preloader-active av-preloader-enabled" === $preloader) { echo avia_preload_screen(); } ?> <div id='wrap_all'> <?php if(!$blank) //blank templates dont display header nor footer { //fetch the template file that holds the main menu, located in includes/helper-menu-main.php get_template_part( 'includes/helper', 'main-menu' ); } ?> <div id='main' class='all_colors' data-scroll-offset='<?php echo avia_header_setting(' header_scroll_offset '); ?>'> <?php if(isset($avia_config['temp_logo_container'])) echo $avia_config['temp_logo_container']; do_action('ava_after_main_container'); echo do_shortcode("[av_submenu which_menu='center' menu='Main Menu' position='center' color='alternate_color' sticky='true' mobile='disabled' mobile_submenu=''][av_submenu_item title='Menu Item 1'][av_submenu_item title='Menu Item 2'] [/av_submenu]"); ?>
- This reply was modified 7 years, 9 months ago by bohn54.
March 1, 2017 at 8:55 am #753521Just as an update, I tried moving the echo command inside of the
<head></head>
tag which fixed the issue on mobile but ended up breaking the desktop site.- This reply was modified 7 years, 9 months ago by bohn54.
March 2, 2017 at 6:53 am #754074Hi!
I was referring to the events calendar templates. Did you modify those files? What if you add the submenu in those files instead of the header.php file?
Regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.