Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #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, 9 months ago by evilmc.
    #1173704

    With 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, 9 months ago by evilmc.
    #1173808

    Hi,
    Please add following code to Functions.php file in Appearance > Editor

    add_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 Shannon

    #1174026
    This reply has been marked as private.
    #1175242

    Hi,

    Thank you for the update.

    We adjusted the filter a bit. Please try it again.

    Best regards,
    Ismael

    #1175382

    Where is a new filter code?

    #1175713

    Hi,

    Ismael must have edited Jordans reply

    Best regards,
    Basilis

    #1175720

    Okay, i add that code and nothing happened. Hyperlink still there in H1 tag…

    #1176179

    Hi,

    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,
    Ismael

    #1245066

    But 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 h2

    Maybe this should be the standard on helper-post-format.php – because it does not make sense to link to the post itself

    #1245080

    Thank you so much, this worked perfectly ;)

    #1245246

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Remove huperlink from Blog single post H1 titles’ is closed to new replies.