Support » Plugin: Event Espresso 4 Decaf - Event Registration Event Ticketing » Featured Image Missing from Events Page

  • Resolved hypevent

    (@hypevent)


    1) The https://www.tryhypnosisnow.com/events/ page is blog archive page that does not show the featured image.

    I tried to add this to archives.php but there was an error

    <?php it_exchange_set_product( $post->ID ); ?>
    <?php it_exchange( 'product', 'featured-image', array( 'size' => 'thumbnail' ) ); ?>

    but there was an error due to this line of code in plugins/event-espresso-decaf/core/domain/services/pue/Stats.php

    $settings_url = EE_Admin_Page::add_query_args_and_nonce(

    2) I am also getting a URL marked “noindex” for https://www.tryhypnosisnow.com/event-type/single-event/. in Google Search Console

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Contributor Josh Feck

    (@builtbynorthby)

    Hi,

    The code you tried is actually for iThemes Exchange products. What you can do instead is add:
    the_post_thumbnail();
    to your theme’s archive.php file.

    With regards to the single-event route having a noindex meta “robots” tag, that’s intended to avoid indexing duplicate content. Is there a reason you want that route to be indexed anyway, or were you wondering why it’s set to noindex?

    Just the_post_thumbnail();?

    I understand why but because it is a blog archive page I do not know how to remove it from my sitemap.

    Plugin Contributor Josh Feck

    (@builtbynorthby)

    Yes, just the_post_thumbnail(); will add the featured image. If you require custom sizes or custom classes for CSS there are parameters you can pass in. You’ll find code examples here:

    https://developer.wordpress.org/reference/functions/the_post_thumbnail/#user-contributed-notes

    I understand why but because it is a blog archive page I do not know how to remove it from my sitemap.

    May I ask how is the sitemap generated? There may be a way to filter the sitemap so it’s not added.

    I added <?php the_post_thumbnail();? ?> after Start the Loop but I received the following error:

    Your PHP code changes were rolled back due to an error on line 148 of file wp-content/plugins/event-espresso-decaf/core/domain/services/pue/Stats.php. Please fix and try saving again.
    Class ‘EE_Admin_Page’ not found

    The sitemap is created by Yoast

    Plugin Contributor Josh Feck

    (@builtbynorthby)

    <?php the_post_thumbnail();? ?>

    is not correct syntax.

    <?php the_post_thumbnail(); ?>
    is correct.

    I can take a look at the Yoast plugin, I think there may be a way to filter out the event-type taxonomy.

    That was a typo in my last message. I added <?php the_post_thumbnail(); ?> after Start the Loop but I received the following error:

    Your PHP code changes were rolled back due to an error on line 148 of file wp-content/plugins/event-espresso-decaf/core/domain/services/pue/Stats.php. Please fix and try saving again.
    Class ‘EE_Admin_Page’ not found

    Line 148: $settings_url = EE_Admin_Page::add_query_args_and_nonce(

    Plugin Contributor Tony Warwick

    (@pebblo)

    To fix that error, simply dismiss the notice that shows:

    The Event Espresso UXIP feature is not yet active on your site. For more info and to opt-in click here.

    From within the admin, then retry.

    That worked. Thanks

    What about set the featured image for this page?
    https://www.tryhypnosisnow.com/events/miami-hypnosis-certification/

    Plugin Contributor Josh Feck

    (@builtbynorthby)

    You can add
    <?php the_post_thumbnail(); ?>
    to the theme’s single.php template file and that will display the featured image to that page.

    Then, to remove that single-event URL from the Yoast XML sitemap, you can add the following code from this gist:

    https://gist.github.com/joshfeck/e3f536564257d0a3d210ae685dfca3ca

    You can add PHP code from the above to a functions plugin or into your WordPress child theme’s functions.php file.

    I added the line of code (see below) but the featured image is not visible

    get_header(); ?>
    
    		<div id="primary">
    			<div id="content" role="main">
    
    				<?php while ( have_posts() ) : the_post(); ?>
    <span class="date updated"><?php the_time(); ?></span>
    
    					<nav id="nav-single">
    						<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
    						<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span> Previous', 'twentyeleven' ) ); ?></span>
    						<span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?></span>
    					</nav><!-- #nav-single -->
    
    					<?php get_template_part( 'content', 'single' ); ?>
    
    					<?php comments_template( '', true ); ?>
    					
    					<?php the_post_thumbnail(); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    Plugin Contributor Josh Feck

    (@builtbynorthby)

    A few possibilities why it’s not showing:

    There’s another template loading (instead of single.php)

    The single.php you edited isn’t in the active theme’s folder. For example, if you’re working with a child theme, then you make the edit to the single.php template within the child theme.

    Side note: since the content-single.php template part is called, you could instead add the_post_thumbnail(); to the content-single.php template file. This will give you more control over where the image is displayed.

    Is there a way to check which template is loading?

    I believe the single.php is in the active theme’s folder.

    Is there somewhere specifically the code the_post_thumbnail(); should go?

    <?php
    /**
     * The template for displaying content in the single.php template
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<header class="entry-header">
    		<h1 class="entry-title"><?php the_title(); ?></h1>
    		
            <?php the_post_thumbnail(); ?>
    
    		<?php if ( 'post' == get_post_type() ) : ?>
    		<div class="entry-meta">
    			<?php twentyeleven_posted_on(); ?>
    		</div><!-- .entry-meta -->
    		<?php endif; ?>
    	</header><!-- .entry-header -->
    
    	<div class="entry-content">
    		<?php the_content(); ?>
    		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
    	</div><!-- .entry-content -->
    
    	<footer class="entry-meta">
    		<?php
    			/* translators: used between list items, there is a space after the comma */
    			$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
    
    			/* translators: used between list items, there is a space after the comma */
    			$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
    			if ( '' != $tag_list ) {
    				$utility_text = __( 'This entry was posted in %1$s and tagged %2$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
    			} elseif ( '' != $categories_list ) {
    				$utility_text = __( 'This entry was posted in %1$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
    			} else {
    				$utility_text = __( 'This entry was posted by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
    			}
    
    			printf(
    				$utility_text,
    				$categories_list,
    				$tag_list,
    				esc_url( get_permalink() ),
    				the_title_attribute( 'echo=0' ),
    				get_the_author(),
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
    			);
    		?>
    		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
    
    		<?php if ( get_the_author_meta( 'description' ) && ( ! function_exists( 'is_multi_author' ) || is_multi_author() ) ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries ?>
    		<div id="author-info">
    			<div id="author-avatar">
    				<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) ); ?>
    			</div><!-- #author-avatar -->
    			<div id="author-description">
    				<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
    				<?php the_author_meta( 'description' ); ?>
    				<div id="author-link">
    					<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
    						<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyeleven' ), get_the_author() ); ?>
    					</a>
    				</div><!-- #author-link	-->
    			</div><!-- #author-description -->
    		</div><!-- #author-info -->
    		<?php endif; ?>
    	</footer><!-- .entry-meta -->
    </article><!-- #post-<?php the_ID(); ?> -->
    Plugin Contributor Josh Feck

    (@builtbynorthby)

    Is there a way to check which template is loading?

    You can install, then activate this plugin:
    https://wordpress.org/plugins/show-current-template/

    Then view the page while logged in as admin. The show current template plugin will display the template information in the WP Toolbar.

    Is there somewhere specifically the code the_post_thumbnail(); should go?

    It can go anywhere except where ever there’s logic that would prevent it from displaying. For example you would not want to put it right after:
    if ( 'post' == get_post_type() ) :
    because then it would only display if the post type is post.

    I installed the plugin and added the code to the correct template. I now see the images. Thank you.

    Is there a way to remove the details area from being visible to visitors?

    Details
    Sale Dates
    – The dates when this option is available for purchase.
    Goes On Sale: 06/27/2019 3:45 PM
    Sales End: 12/17/2019 11:55 PM

    Access
    – This option allows access to the following dates and times.
    DATE TIME
    SOLD
    REMAINING
    TOTAL
    SOLD
    TOTAL SPACES
    LEFT
    12/26/2019 to 12/27/2019 9:30 AM to 5:00 PM 0 25 0 25

    Plugin Contributor Josh Feck

    (@builtbynorthby)

    Hi,

    You could hide those with CSS, or if you upgrade to the paid version that adds additional options (in Event Espresso > Events > Templates) for removing the entire details area.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Featured Image Missing from Events Page’ is closed to new replies.