• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Title attribute on feature images

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Title attribute on feature images

This topic is: resolved

Tagged: attribute, feature image, title

  • This topic has 4 replies, 2 voices, and was last updated 10 years, 3 months ago by SirTzusky.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • September 10, 2015 at 4:47 am #165093
    SirTzusky
    Member

    Hi everyone,

    I'm having problems displaying title attribute on feature images.
    I use grid loop to show my posts on archive pages like homepage or so: http://4kwallpapers.co/
    Here's my function wich I use to display the grid:

    function child_grid_loop() {
    
    	//* Global vars
    	global $_genesis_loop_args;
    
    	//* Parse args
    	$args = apply_filters(
    		'genesis_grid_loop_args',
    		wp_parse_args(
    			$args,
    			array(
    			
    				'grid_image_size'		=> 'grid-thumbnail',
    				'grid_image_class'		=> 'alignleft',
    				'grid_content_limit'	=> 0,
    				'more'					=> '',
    			)
    		)
    	);
    
    	
    
    	//* What page are we on?
    	$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
    
    	//* Set global loop args
    	$_genesis_loop_args = $args;
    
    //hooks and filters for 
     if ( !is_page_template( 'page-info.php' ) || is_home() || is_archive()) {
    remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    add_action( 'genesis_entry_header', 'genesis_do_post_image', 8 );
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
    remove_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 12 );
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    remove_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 12 );
    remove_action( 'genesis_entry_content', 'genesis_do_post_permalink', 14 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    }
    	//* The loop
    	genesis_standard_loop();
    
    	//* Reset loops
    	genesis_reset_loops();
    	remove_filter( 'post_class', 'genesis_grid_loop_post_class' );
    	remove_action( 'genesis_post_content', 'genesis_grid_loop_content' );
    	remove_action( 'genesis_entry_content', 'genesis_grid_loop_content' );
    }
    

    Any help will be appreciated,
    Thank you,
    Gabriel

    http://4kwallpapers.co/
    September 10, 2015 at 5:28 am #165099
    Victor Font
    Moderator

    When you say title attribute, are you referring to the image title attribute or the post title? The genesis_do_post_image function calls the WordPress wp_get_attachment_image function to create the image element. Assuming you've added a title attribute through the media library to each image, the wp_get_attachment_image function contains a foreach loop that adds all image related attributes to the img tag. The image title attribute is not a display element. If you want the post title, then don't remove it as you are doing in your code.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    September 10, 2015 at 2:05 pm #165157
    SirTzusky
    Member

    Hi Victor,
    Thank you for your answer.
    Yes, I'm referring to the image title attribute. Not the post title (this I remove on purpose).

    Can you tell me more specifically how I use the wp_get_attachment_image function to display the title attribute in the above child_grid_loop function? My WordPress/Genesis knowledge is not that good.

    Thank you in advance,
    Gabriel

    September 10, 2015 at 2:21 pm #165158
    Victor Font
    Moderator

    The code below will retrieve an image title. You'll have to figure out how to add it to your loop:

    $title = get_post(get_post_thumbnail_id())->post_title;


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    September 10, 2015 at 11:53 pm #165190
    SirTzusky
    Member

    Thank you for your answer. I just take a look on other child themes from Genesis. It seems that none of them use title attribute on loops...that's odd...

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Title attribute on feature images’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble