Disable link and alt on the icons Post Formats

Community Forums Forums Design Tips and Tricks Disable link and alt on the icons Post Formats

This topic is: resolved

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  rfmeier 5 months, 2 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #108284

    macrunner
    Participant
    Post count: 45

    In Genesis Sample I am using Post Formats, I followed this guide: http://my.studiopress.com/snippets/post-formats/

    you can disable the URL link and ALT info on icon? In practice, I would like to display only the icon, without link and alt.

    I found this snippet of code in the file themes/genesis/lib/structure/post.php

    //* Get post format
    	$post_format = get_post_format();
    
    	//* If post format is set, look for post format image
    	if ( $post_format && file_exists( sprintf( '%s/images/post-formats/%s.png', CHILD_DIR, $post_format ) ) )
    		printf( '<a href="%s" title="%s" rel="bookmark"><img src="%s" class="post-format-image" alt="%s" /></a>', get_permalink(), the_title_attribute( 'echo=0' ), sprintf( '%s/images/post-formats/%s.png', CHILD_URL, $post_format ), $post_format );
    
    	//* Else, look for the default post format image
    	elseif ( file_exists( sprintf( '%s/images/post-formats/default.png', CHILD_DIR ) ) )
    		printf( '<a href="%s" title="%s" rel="bookmark"><img src="%s/images/post-formats/default.png" class="post-format-image" alt="%s" /></a>', get_permalink(), the_title_attribute( 'echo=0' ), CHILD_URL, 'post' );
    
    }
    

    I did a lot of attempts but I can not disable links and alt.
    But I do not want to touch the core of Genesis. Maybe you can use a hook in the child theme?

    Thanks for any help

    #108316

    rfmeier
    Participant
    Post count: 597

    Hello,

    Since there is not a filter or action within the Genesis core callback, the default callback will have to be removed and a new custom callback will have to be attached in it’s place. Try the code below;

    https://gist.github.com/rfmeier/8cbe9895612a9dff5a95


    • This reply was modified 5 months, 2 weeks ago by  rfmeier.
    • This reply was modified 5 months, 2 weeks ago by  rfmeier.
    #108365

    macrunner
    Participant
    Post count: 45

    Hi Ryan,

    I used the code, it works wonderfully ;)

    Thank you very much

    #108369

    rfmeier
    Participant
    Post count: 597

    You are welcome. I am glad I could help.


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.