-
AuthorPosts
-
January 14, 2020 at 10:19 pm #1173690
Hello,
How to remove H1 title hyperlink from single blog post?
EDIT:
This solution works!
#top.single-post .post-title.entry-title a, .entry-content a img{pointer-events: none!important;cursor: default!important;}
p a.aligncenter{pointer-events:none!important;}- This topic was modified 4 years, 11 months ago by evilmc.
January 14, 2020 at 10:37 pm #1173704With this CSS everything work good! But when I look in inspect element i still see the huperlink from H1 title! This is really nightmare! How to completely remove H1 hyperlink title from code for single post titles?
- This reply was modified 4 years, 11 months ago by evilmc.
January 15, 2020 at 7:14 am #1173808Hi,
Please add following code to Functions.php file in Appearance > Editoradd_filter('avf_title_args', 'fix_single_post_title', 10, 2); function fix_single_post_title($args,$id) { $args['link'] = false; return $args; }
Best regards,
Jordan ShannonJanuary 15, 2020 at 3:07 pm #1174026This reply has been marked as private.January 17, 2020 at 6:11 am #1175242Hi,
Thank you for the update.
We adjusted the filter a bit. Please try it again.
Best regards,
IsmaelJanuary 17, 2020 at 1:31 pm #1175382Where is a new filter code?
January 17, 2020 at 10:54 pm #1175713Hi,
Ismael must have edited Jordans reply
Best regards,
BasilisJanuary 17, 2020 at 11:08 pm #1175720Okay, i add that code and nothing happened. Hyperlink still there in H1 tag…
January 20, 2020 at 3:36 am #1176179Hi,
Thank you for following up.
Can we access the site? We would like to test the filter and check the settings. Please post the login details in the private field.
Best regards,
IsmaelSeptember 11, 2020 at 7:48 am #1245066But you like to remove only the link option on single post not on the archive post list?
You can see here that i inserted a ternery operator on setting the link in the avia_default_title_filter function on helper-post-format.php
this code here is different to the standard code:$output .= is_singular() ? $current_post['title'] : "<a href='".get_permalink()."' rel='bookmark' title='". __('Permanent Link:','avia_framework')." ".$current_post['title']."'>".$current_post['title']; $output .= "<span class='post-format-icon minor-meta'></span>"; $output .= is_singular() ? '' : '</a>';
so put this to your child-theme functions.php:
function avia_default_title_filter($current_post){ if(!empty($current_post['title'])) { $default_heading = is_singular() ? 'h1' : 'h2'; $args = array( 'heading' => $default_heading, 'extra_class' => '' ); $args = apply_filters( 'avf_customize_heading_settings', $args, 'avia_default_title_filter', array( $current_post ) ); $heading = ! empty( $args['heading'] ) ? $args['heading'] : $default_heading; $css = ! empty( $args['extra_class'] ) ? $args['extra_class'] : ''; $output = ""; //$output .= "<{$heading} class='post-title entry-title ". avia_offset_class('meta', false). "'>"; $output .= "<{$heading} class='post-title entry-title {$css}' ".avia_markup_helper(array('context' => 'entry_title','echo'=>false)).">"; $output .= is_singular() ? $current_post['title'] : "<a href='".get_permalink()."' rel='bookmark' title='". __('Permanent Link:','avia_framework')." ".$current_post['title']."'>".$current_post['title']; $output .= "<span class='post-format-icon minor-meta'></span>"; $output .= is_singular() ? '' : '</a>'; $output .= "</{$heading}>"; $current_post['title'] = $output; } return $current_post; }
and by the way you can change here the tag of the heading on archives and single post on this line above:
$default_heading = is_singular() ? 'h1' : 'h2';
this is ternery operator again – if you have a single post it is h1 – else h2Maybe this should be the standard on helper-post-format.php – because it does not make sense to link to the post itself
September 11, 2020 at 9:21 am #1245080Thank you so much, this worked perfectly ;)
September 12, 2020 at 5:00 am #1245246Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Remove huperlink from Blog single post H1 titles’ is closed to new replies.