Forum Replies Created
-
AuthorPosts
-
Ben
ParticipantI notice that you have some code in Templates.php and Template_Factory.php to try and deal with this situation (see below). Wouldn’t it be easier to publish an app note for theme developers on how to be compatible with your plug-in? That would help me and other users to get this resolved. Maybe you’ve already done this and I can’t find it. I don’t want to install patches that I have to maintain to make the Event Calendar work properly, so please don’t refer me to those threads. Thanks. –Gene
Template_Factory.php
// implement a filter for the page title. Support WordPress < 4.4
add_filter( 'wp_title', array( $this, 'title_tag' ), 10, 2 );// implement a filter for the page title. Support WordPress >= 4.4
add_filter( 'document_title_parts', array( $this, 'title_tag' ) );// implement a filter for the page title. Support WordPress < 4.4
add_filter( 'wp_title', array( $this, 'title_tag' ), 10, 2 );// implement a filter for the page title. Support WordPress >= 4.4
add_filter( 'document_title_parts', array( $this, 'title_tag' ) );
Templates.php
/**
* Fix issues where themes display the_title() before the main loop starts.
*
* With some themes the title of single events can be displayed twice and, more crucially, it may result in the
* event views such as month view prominently displaying the title of the most recent event post (which may
* not even be included in the view output).
*
* There's no bulletproof solution to this problem, but for affected themes a preventative measure can be turned
* on by adding the following to wp-config.php:
*
* define( 'TRIBE_MODIFY_GLOBAL_TITLE', true );
*
* Note: this reverses the situation in version 3.2, when this behaviour was enabled by default. In response to
* feedback it will now be disabled by default and will need to be turned on by adding the above line.
*
* @see issues #24294, #23260
*/
public static function maybe_modify_global_post_title() {
global $post;// We will only interfere with event queries, where a post is set and this behaviour is enabled
if ( ! tribe_is_event_query() || ! defined( 'TRIBE_MODIFY_GLOBAL_TITLE' ) || ! TRIBE_MODIFY_GLOBAL_TITLE ) {
return;
}
if ( ! isset( $post ) || ! $post instanceof WP_Post ) {
return;
}// Wait until late in the wp_title|document_title_parts hook to actually make a change - this should allow single event titles
// to be used within the title element itself
add_filter( 'document_title_parts', array( __CLASS__, 'modify_global_post_title' ), 1000 );
add_filter( 'wp_title', array( __CLASS__, 'modify_global_post_title' ), 1000 );
}/**
* Actually modifies the global $post object's title property, setting it to an empty string.
*
* This is expected to be called late on during the wp_title action, but does not in fact alter the string
* it is passed.
*
* @see Tribe__Events__Templates::maybe_modify_global_post_title()
*
* @param string $title
*
* @return string
*/
public static function modify_global_post_title( $title = '' ) {
global $post;// Set the title to an empty string (but record the original)
self::$original_post_title = $post->post_title;
$post->post_title = apply_filters( 'tribe_set_global_post_title', '' );// Restore as soon as we're ready to display one of our own views
add_action( 'tribe_pre_get_view', array( __CLASS__, 'restore_global_post_title' ) );// Now return the title unmodified
return $title;
}/**
* Restores the global $post title if it has previously been modified.
*
* @see Tribe__Events__Templates::modify_global_post_title().
*/
public static function restore_global_post_title() {
global $post;
$post->post_title = self::$original_post_title;
remove_action( 'tribe_pre_get_view', array( __CLASS__, 'restore_global_post_title' ) );
}
Ben
ParticipantHi Goeff, I did as you suggested. In the meantime, is there any way we could get the community events list extended to show description and cost as a bug fix? Seems like that is an oversight to me.
Ben
ParticipantMust have copied the code incorrectly. The mod is working now. However, it would be nice to have a setting that allows selection of required fields rather than having to maintain a patch. Thanks –Gene
Ben
ParticipantI added the following code to the end of my Illustrious theme’s functions file. The entire file is below. It isn’t working–I get a bunch of errors, also below. Could you point me to the place where the required files are defined in the Community Events plugin?
<?php if(!isset($content_width)) $content_width = 640;
define(‘CPOTHEME_ID’, ‘illustriouspro’);
define(‘CPOTHEME_NAME’, ‘Illustrious Pro’);
define(‘CPOTHEME_VERSION’, ‘1.3.0’);
//Other constants
define(‘CPOTHEME_LOGO_WIDTH’, ‘195’);
define(‘CPOTHEME_USE_SLIDES’, true);
define(‘CPOTHEME_USE_FEATURES’, true);
define(‘CPOTHEME_USE_PORTFOLIO’, true);
define(‘CPOTHEME_THUMBNAIL_WIDTH’, ‘600’);
define(‘CPOTHEME_THUMBNAIL_HEIGHT’, ‘400’);//Load Core; check existing core or load development core
$core_path = get_template_directory().’/core/’;
if(defined(‘CPOTHEME_CORE’)) $core_path = CPOTHEME_CORE;
require_once $core_path.’init.php’;$include_path = get_template_directory().’/includes/’;
//Main components
require_once($include_path.’setup.php’);add_filter( ‘tribe_events_community_required_fields’, ‘my_community_required_fields’, 10, 1 );
function my_community_required_fields( $fields ) {
$fields = array(
‘post_title’,
);
}Warning: array_merge(): Argument #1 is not an array in /home/jsowebmaster/jazzoregon.com/wp-content/plugins/the-events-calendar-community-events/src/Tribe/Captcha/Abstract_Captcha.php on line 121
My Events
Not Gene Forte? Log OutWarning: array_merge(): Argument #1 is not an array in /home/jsowebmaster/jazzoregon.com/wp-content/plugins/the-events-calendar-community-events/src/Tribe/Captcha/Abstract_Captcha.php on line 121
Warning: in_array() expects parameter 2 to be array, null given in /home/jsowebmaster/jazzoregon.com/wp-content/plugins/the-events-calendar-community-events/src/functions/template-tags.php on line 482
Event Title:Warning: array_merge(): Argument #1 is not an array in /home/jsowebmaster/jazzoregon.com/wp-content/plugins/the-events-calendar-community-events/src/Tribe/Captcha/Abstract_Captcha.php on line 121
Warning: in_array() expects parameter 2 to be array, null given in /home/jsowebmaster/jazzoregon.com/wp-content/plugins/the-events-calendar-community-events/src/functions/template-tags.php on line 482
Event Description:Ben
ParticipantThis reply is private.
Ben
ParticipantHi Cliff, I looked at your reference, but I think it is overlay complex for what I need. I simply want to remove the requirement to enter a description when it is not needed/wanted. Is there a simple way to do that directly without getting into how to add more required fields? Thanks, Gene
-
This reply was modified 9 years, 10 months ago by
Ben.
June 16, 2016 at 9:47 am in reply to: Where are the Event Calendar files located? Can't find them in plug-ins folder. #1127993Ben
ParticipantThis reply is private.
-
This reply was modified 9 years, 10 months ago by
-
AuthorPosts
