简体   繁体   English

Wordpress“事件日历”编辑月视图

[英]Wordpress "The Events Calendar" editing the month view

I am working to edit the month view of "The Events Calendar" in Wordpress.我正在编辑 Wordpress 中“事件日历”的月视图。 I cannot seem to figure out which files contain the relevant markup.我似乎无法弄清楚哪些文件包含相关标记。 The file structure seems to make sense, however, when I edit anything with /month no changes reflect.文件结构似乎有意义,但是,当我使用 /month 编辑任何内容时,没有任何更改反映。

The File Structure文件结构

文件结构

Core Plugin Files .../plugins/the-events-calendar/src/views/核心插件文件.../plugins/the-events-calendar/src/views/

Here we have several folders with the different views.在这里,我们有几个具有不同视图的文件夹。 One of which is "month" and, according to the documentation, contains the files I wish to edit.其中之一是“月”,根据文档,包含我希望编辑的文件。

Theme Files .../mytheme/tribe-events/主题文件.../mytheme/tribe-events/

This is the folder the documentation told me to create to place edited templates in.这是文档告诉我创建的文件夹,用于放置编辑过的模板。

The Fubar When i follow the documentation for editing a single event located in /list everything works as expected. Fubar当我按照文档编辑位于 /list 中的单个事件时,一切都按预期工作。 All I need to do is create a subfolder in mytheme/tribe-events/list and put a new file within to override the original.我需要做的就是在 mytheme/tribe-events/list 中创建一个子文件夹,并在其中放置一个新文件以覆盖原始文件。

When I repeat these same steps in order to edit a file within /month view things are different.当我重复这些相同的步骤以在 /month 视图中编辑文件时,情况有所不同。 For some reason none of my changes work.出于某种原因,我的任何更改都不起作用。 Outside of the /month folder in /views there is a month.php file which contains the following...在 /views 中的 /month 文件夹之外,有一个 month.php 文件,其中包含以下内容...

do_action( 'tribe_events_before_template' );

// Title Bar
tribe_get_template_part( 'month/title-bar' );

// Tribe Bar
tribe_get_template_part( 'modules/bar' );

//  - My Custom Code - 
write_log('This Log Works');
// Main Events Content
tribe_get_template_part( 'month/content' );

do_action( 'tribe_events_after_template' );

Note: write_log() is a function I use in php for debugging.注意:write_log() 是我在 php 中用于调试的函数。 It's essentially a console.log but appends the data to the end of the error.log file which i have being read by a terminal.它本质上是一个 console.log,但将数据附加到我被终端读取的 error.log 文件的末尾。 I do not believe the issue is with this function as I have tested other methods.我不相信问题出在这个函数上,因为我已经测试了其他方法。

The "month" file echoes my log just fine. “月”文件很好地呼应了我的日志。 However, when I add the same log into any of the files it is pulling from the 'month/' directory I get nothing.但是,当我将相同的日志添加到它从“month/”目录中提取的任何文件中时,我什么也没得到。 I went through every file in the subdirectories and added a log and realized that they all work except any file within /month我浏览了子目录中的每个文件并添加了一个日志,并意识到除了 /month 中的任何文件之外,它们都可以工作

I thought maybe the issue was with the plugins' "tribe_get_template_part()" function pointing to the wrong place so I decided to eliminate the "am i making this child plugin right" variables and just start editing the plugin files directly.我想问题可能出在插件的“tribe_get_template_part()”函数指向错误的地方,所以我决定消除“我是否让这个子插件正确”变量并直接开始编辑插件文件。 But I get the exact same behavior.但我得到了完全相同的行为。 I got so desperate that I deleted the entire /months folder from the plugin and the calendar still worked!我非常绝望,以至于我从插件中删除了整个 /months 文件夹,日历仍然有效!

So obviously I am really missing something but currently I am at a loss.所以显然我真的错过了一些东西,但目前我不知所措。

This documentation is what I've been following to figure this out.这个文档是我一直在关注的内容。 https://support.theeventscalendar.com/153124-Themers-Guide https://support.theeventscalendar.com/153124-Themers-Guide

The only thing I can think of at this point is that the javascript templating system built into the plugin is working some hidden magic but the fact that I can delete the entire months folder leaves me at a loss.在这一点上,我唯一能想到的是插件中内置的 javascript 模板系统正在发挥一些隐藏的魔力,但我可以删除整个月文件夹这一事实让我不知所措。

For anyone struggling with this still, I also had the same issue and solved it by disabling the Month View Cache under Event Settings > Display.对于仍在为此苦苦挣扎的任何人,我也遇到了同样的问题,并通过在事件设置 > 显示下禁用月视图缓存来解决它。 Screenshot:截屏:

禁用月视图缓存

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM