Viewing 23 posts - 1 through 23 (of 23 total)
  • Author
    Posts
  • #539382

    Hi,

    I need to remove the “Permanent Link” from all page and post H1 titles – not just the title attribute, bu the whole A tag around the text. I tried some of the advice I found on the forum, but I can’t seem to make it work.

    Please note, I want to render the page without the link, which means I need a PHP solutions and not jQuery code to remove the tag, or CSS to remove the link styling.

    Preferably, I would appreciate code that can be inserted into my child theme’s functions.php in order to make the change update-proof.

    Thank you,
    Yaniv

    #539651

    Hey yaniv691!

    Please go to Appearance > Editor and open functions-enfold.php file and find

    `
    if(!empty($link) && !empty($title)) $title = "<a href='".$link."' rel='bookmark'>".$title."</a>";
    `

    and change it to

    if(!empty($link) && !empty($title)) $title = $title;

    You can copy the whole “avia_title” function from functions-enfold.php file to functions.php file of your child theme to make the changes update-proof

    Cheers!
    Yigit

    #539850

    Thanks, but this works only on pages but not on posts. How do I do the same on posts?

    • This reply was modified 9 years ago by yaniv691.
    #539857

    Hi!

    Please add following code to Functions.php file as well

    add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
    function fix_single_post_title($args,$id)
    {
        if ( $args['title'] == 'Blog - Latest News' )
        {
            $args['title'] = get_the_title($id);
            $args['link'] = "";
            $args['heading'] = 'h1';
        }
    
        return $args;
    }

    Cheers!
    Yigit

    #539865

    Almost, not quite there: What you sent replaces the “Blog – Latest News” title with the post title in a H1 tag. That’s great!

    But, there’s another post title which is also a H1 tag and has the “Permanent Link”. I would like to remove this title completely, so the page will be rendered with only one H1.

    See here:
    http://yaniv.qwaisdns.com/archive1/?p=25 (see the dark grey title, just above the date)

    #541709

    Hey!

    use this code in Quick CSS code:

    .post-title.entry-title {
    display: none;
    }
    

    Regards,
    Andy

    #541714

    Thanks Andy, but this is exactly what I don’t want – two H1 tags and just hide one of them.

    You can’t fool Google by hiding the addtional H1 tag with CSS. I would like the HTML of the page to be rendered with only one H1 tag.

    Thanks!

    #541715

    Hi!

    Please try adding following code to Functions.php file as well

    add_filter('avf_title_args', 'fix_single_post_title_h1', 10, 2);
    function fix_single_post_title_h1($args,$id)
    {
        if (is_single())
        {
            $args['title'] = get_the_title($id);
            $args['link'] = "";
            $args['heading'] = 'span';
        }
    
        return $args;
    }

    Cheers!
    Yigit

    #710925

    this code in the functions.php works for me to remove the link from the headings:

    add_filter(‘avf_title_args’, ‘fix_single_post_title_h1’, 10, 2);
    function fix_single_post_title_h1($args,$id)
    {
    if (is_single())
    {
    $args[‘title’] = get_the_title($id);
    $args[‘link’] = “”;
    $args[‘heading’] = ‘span’;
    }

    return $args;
    }

    thanks for this! however, it changes the posts page title where all the posts are displayed from “blog” to the main title of the most recent post. any fix for this?

    #710926

    Hey!

    Please remove following line from your code

    $args[‘title’] = get_the_title($id);

    Cheers!
    Yigit

    #710928

    i tried removing that line, and now all of the links are back. any other ideas? i am using only that code in the functions.php

    #710929

    ok i got it i believe!

    used this:

    add_filter(‘avf_title_args’, ‘fix_single_post_title’, 10, 2);
    function fix_single_post_title($args,$id)
    {
    $args[‘link’] = “”;
    $args[‘heading’] = ‘h1’;

    return $args;
    }

    will let you know if anything else comes up, thanks!!

    #710950

    Hi,

    Glad it worked for you! :)

    We will keep the thread open and will wait to hear from the creator of this thread. If you have any other questions or issues, please feel free to start a new thread.

    Best regards,
    Yigit

    #722721

    hi, i am back,

    any chance on how to also remove the links from the blog post titles?

    #723690

    Hi,

    Would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :)

    Best regards,
    Andy

    #724050

    There is the link, i have already set the heading of blog to not show, now i am talking about the post title. thanks!

    #724480

    Hi,

    use this code:

    .post-title.entry-title {
    display: none;
    }

    Best regards,
    Andy

    #724532

    I dont want a css code, i am looking for a function similar to the one already posted to remove the post title links as well, please advise

    #725250

    Hi,

    check out general WordPress tutorials about this: http://www.wpbeginner.com/plugins/how-to-hide-post-and-page-titles-in-wordpress-single-pages/

    Best regards,
    Andy

    #735271

    Hello,

    How can I combine the two codes to remove the link from both pages and blog posts? I am using the child theme.

    #735604

    Hi,

    did you check the Title “Bar Settings” options when editing a page/post? there you can remove any titles.

    Best regards,
    Andy

    #735788

    Hi Andy,

    I don’t want to remove the title. Like the original thread; I just want to remove the link from the title. You suggested 2 codes but I am not sure how can I combine them together in the functions.php file. When I added both of them I got an error.

    #736380

    Hi,

    it helps to be very precise with us, so we know exactly what you want.

    Use this code inside Quick CSS field:

    .post-title.entry-title {
    pointer-events: none;
    }

    Best regards,
    Andy

Viewing 23 posts - 1 through 23 (of 23 total)
  • You must be logged in to reply to this topic.