Changing the general.php file

Home Forums Calendar Products Events Calendar PRO Changing the general.php file

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #124316
    James
    Participant

    I want to edit the public>template-tags>general.php file. I can make edits in the plugin source files (and they work great), but I don’t know where to save the new file in my template, so that it won’t be replaced on plugin update.

    #124440
    Barry
    Member

    That file is not intended to be overrideable, I’m afraid. Can you describe what you are trying to accomplish here? There might be an alternative way of doing it.

    #124498
    James
    Participant

    I have used it to insert a default image when the event doesn’t have a featured image set.

    I also don’t want the big year divider to show when an event is in a prior year. At the very least, I need to be able to MOVE it (for some reason, the default is
    month header — APRIL 2012
    year divider — 2012
    I can swap these around in the general.php file, but then if I update, they’ll be lost.

    #125391
    Barry
    Member

    OK, so for featured images we use our own tribe_event_featured_image() function – this is filterable, though, using a hook of the same name so you could add a placeholder using some logic like this (which you might place in your theme’s functions.php file).

    Similarly you can filter and adapt or remove the date separators using our tribe_events_list_the_date_headers filter hook.

    Does that help?

    #125543
    James
    Participant

    Worked great.
    There were a few changes, which I’ll share here in case someone else wants/needs to use it:

    add_filter( 'tribe_event_featured_image', 'featured_event_img_placeholder' );
     
    function featured_event_img_placeholder( $html ) {
            if ( empty( $html ) ) {
    		$html = '<div class="default-calendar-icon tribe-events-event-image"><a href="'. tribe_get_event_link() .'" title="'. get_the_title( $post_id ) .'"><img src="http://fwatest.org/content/uploads/2014/03/Calendar-ICON.jpg" title="'. get_the_title( $post_id ) .'" /></a></div>';
    		}
    		
    		 return $html;
    }

    THANK YOU!!!

    #134952
    Barry
    Member

    Awesome 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Changing the general.php file’ is closed to new replies.