• Resolved mikehermary

    (@mikehermary)


    Hello,

    I am using the filter function found here to override the display of the first event title for all TEC views, but it is not working. This code has been added to my custom theme’s functions.php file.

    I am using the following function in my theme’s template-tags.php file to display a background image with the the_title displayed over top on all of the calendar views.

    if ( ! function_exists( 'flagstaffcounty_event_thumbnail' ) ) :
      /**
       * Displays an optional post thumbnail.
       *
       * Wraps the post thumbnail in a figure element when on event views.
       */
      function flagstaffcounty_event_thumbnail() {
        $url = site_url();
    
        : ?>
          <figure class="page-thumbnail" style="background-image: url(<?php echo $url; ?>/wp-content/uploads/2022/01/generic-page-title-banner.jpg);" itemprop="image" itemscope="" itemtype="https://schema.org/ImageObject">
            <header class="entry-header">
              <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
            </header><!-- .entry-header -->
          </figure>
        <?php
        endif;
      }
    endif;

    Would there be a conflict between this code and the TEC title override function? None of my other pages that display core posts or pages, or Toolset CPT items are encountering issues with this function.

    Cheers,

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Darian

    (@d0153)

    Hi @mikehermary

    Thanks for reaching out. I think the filter found on this page, is for the <title> tag of the page. Please look for the_title() or get_the_title() from your theme and replace it with the Conditional Wrappers for Event View.

    Like what is shown on the last snippet code on this page.

    I hope this helps, and please let me know if you have further concerns.

    Thread Starter mikehermary

    (@mikehermary)

    Hello,

    I have followed those steps, but now the opposite is occurring. The text “Events Calendar” is displaying on all of the pages, even for single events.

    I have included my updated template tags function code below for reference. The duplicate function has been removed from the main functions.php file.

    if ( ! function_exists( 'flagstaffcounty_event_thumbnail' ) ) :
      /**
       * Displays an optional post thumbnail.
       *
       * Wraps the post thumbnail in a figure element when on event views.
       */
      function flagstaffcounty_event_thumbnail() {
        $url = site_url(); ?>
          <figure class="page-thumbnail" style="background-image: url(<?php echo $url; ?>/wp-content/uploads/2022/01/generic-page-title-banner.jpg);" itemprop="image" itemscope="" itemtype="https://schema.org/ImageObject">
            <header class="entry-header">
              <?php
              if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page ?>
                <h1 class="entry-title">
                  <?php esc_html_e( "Events Calendar", "flagstaffcounty" ); ?>
                </h1>
              <?php } elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages ?>
                <h1 class="entry-title">
                  <?php esc_html_e( "Events Calendar", "flagstaffcounty" )  . ' &raquo; ' . single_term_title('', false); ?>
                </h1>
              <?php } elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List ?>
                <h1 class="entry-title">
                  <?php esc_html_e( "Events List", "flagstaffcounty" ); ?>
                </h1>
              <?php } elseif( tribe_is_event() && is_single() ) { // Single Events
                echo the_title();
              } elseif( tribe_is_day() ) { // Single Event Days
                echo '<h1 class="entry-title">Events on: ' . date('F j, Y', strtotime($wp_query->query_vars['eventDate'])) . '</h1>';
              } elseif( tribe_is_venue() ) { // Single Venues ?>
                <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
              <?php } else { ?>
                <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
              <?php }
              ?>
            </header><!-- .entry-header -->
          </figure>
        <?php
      }
    endif;
    Plugin Support Darian

    (@d0153)

    Hi @mikehermary

    Does the issue persist if you only activate our plugins and use a basic theme (2020 WP theme)??I suggest conducting these tests on a Staging Server.

    Could you provide the version of the following? This will help me understand how your system is set up.

    • PHP
    • WordPress
    • The Events Calendar
    • Theme
    Thread Starter mikehermary

    (@mikehermary)

    Hello,

    I have setup a staging server, and tested with the WP 2020 theme. It looks like the 2020 theme does not support the display of the page titles.

    Here are the setup details:

    • PHP 8.0
    • WordPress 6.1.1
    • The Events Calendar 6.0.8
    • Custom theme

    Cheers,

    Plugin Support Darian

    (@d0153)

    Hi @mikehermary

    Could you try replacing tribe_is_month() with tribe_context()->get( 'view_request' ) === 'month' and check if that helps.

    Thread Starter mikehermary

    (@mikehermary)

    Hello,

    No luck with those code adjustments. The monthly view is now displaying Event List as the heading and the individual events are not using the the_title( '<h1 class="entry-title">', '</h1>' ); code.

    Cheers,

    Thread Starter mikehermary

    (@mikehermary)

    Hello,

    Further to the title text issue, the date displayed on individual day listings is incorrect.

    For example, the URL is displayed https://domain.com/events/2023-02-10/, but the title is displayed Events on: January 1, 1970.

    None of the other interface elements display the incorrect date.

    Cheers,

    Plugin Support Abz

    (@abzlevelup)

    Hi @mikehermary, thanks for your patience and for trying out a couple of suggested solution on this thread. Let’s see.

    I wasn’t able to replicate the issue on my end. Could you share the direct URL to the page you’re having issues with? Please do not share any credentials. This is for us to follow the WordPress Forum Guidelines.

    Looking forward to hearing from you.

    Best,
    Abz

    Thread Starter mikehermary

    (@mikehermary)

    Hello,

    Sorry for the delayed reply. You can review the in-development events pages here: https://www.flagstaff.ab.ca/events/. When you navigate to the single, past event, you will notice the page title does not change from Events Calendar to the name of the event.

    Cheers,

    Plugin Support Darian

    (@d0153)

    Hi @mikehermary

    Thanks for your response.

    Where does the flagstaffcounty_event_thumbnail function getting called from your theme? I’d like to try to replicate it on my end.

    Thread Starter mikehermary

    (@mikehermary)

    Hello,

    The function is loaded from the template-tags.php file located in the inc directory.

    I have a similar function for handling the display of WordPress core post and page titles, and it works without issue.

    Cheers,

    Plugin Support Darian

    (@d0153)

    Hi @mikehermary

    Thanks for your response.

    Unfortunately, I still could not replicate the issue since I am not familiar how your theme is structured. I thought the function was defined inside the theme’s functions.php.

    By any chance, do you know a theme that is structured like your theme, that is also available for download from WP themes? I’d like to test it from there.

    Looking forward to your reply.

    Thread Starter mikehermary

    (@mikehermary)

    Hello,

    The theme was developed using Underscore Me as the basis.

    I have moved the event thumbnail function into the functions.php file, but it did not resolve the issue.

    Cheers,

    Plugin Support Darian

    (@d0153)

    Hi @mikehermary

    Thanks for your response. I tried to replicate the issue on my end using a fresh copy of Underscore me theme, and it is working as expected.

    I added the your function to inc/template-tags.php, and called the same function from the header.php, and the title is working as expected on single events page.

    The issue you’re encountering could be related to the customization implemented on your theme.

    Please note that we are limited in the amount of support that we can provide for customizations, but if you get stuck or have any questions, please let me know – I’ll be happy to try to point you in the right direction!

    Plugin Support Darian

    (@d0153)

    Hi @mikehermary

    This thread has been inactive for a while, so we’ll go ahead and mark it Resolved. Please open a new thread if any other questions arise, and we’d be happy to help.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Title conflicts’ is closed to new replies.