Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1129370

    I’m using the link format on my blog posts so that the image and title link to the URL I have in my content. Works fine. However, it is changing the title of the post to the text that is used for the link in the content, on the posts page.
    How would I make it so the title remains the same (title of post) but just be linked to the URL I am using in the content. I don’t want the title to appear different just be linked.

    I tried to override helper.post-format.php in my child theme, but that doesn’t see to do it. Maybe there is a function I can use to accomplish this.
    Thanks for your help

    #1129839

    Hey jberg1,

    Thank you for using Enfold.

    Can you give us a link to the page with the blog posts? Try to edit the helper-post-format.php file and remove line 268.

    $current_post['title'] = $link;
    

    And this code around line 278:

    $current_post['title'] = $link[0];
    

    This will prevent the filter from overriding the default title.

    Best regards,
    Ismael

    #1129856

    Thanks Ismael,
    Unfortunately, that didn’t work. I removed line 269
    $current_post['title'] = $link;
    but, there was already
    $current_post['title'] = $link[0];
    on line 279.

    This is what I ended up doing. Changing line 311 from
    $current_post['title'] = "<{$heading} class='post-title entry-title {$css}' ".avia_markup_helper(array('context' =>'entry_title','echo'=>false)).">".$current_post['title']."</{$heading}>";
    to this
    $current_post['title'] = "<$heading} class='post-title entry-title {$css}' ".avia_markup_helper(array('context' => 'entry_title','echo'=>false))."><a href='$link' rel='bookmark' title='".the_title_attribute('echo=0')."' $markup>".get_the_title()."</a></{$heading}>";

    But I guess I’m wondering about overwriting when theme updates.
    Can helper-post-format.php be overridden in child theme?

    Thanks for your help.
    dev.cholonconcepts.com/news-events/

    #1130241

    Hi,

    Can helper-post-format.php be overridden in child theme?

    You can remove or disable the default “avia_link_content_filter” filter and create your own.

    
    remove_filter( 'post-format-link', 'avia_link_content_filter', 10, 1 );
    add_filter( 'post-format-link', 'avia_link_content_filter_mod', 10, 1 );"
    function avia_link_content_filter_mod() {
       // your own mods here
    }
    

    Just copy the content of the default filter, then do your own modifications.

    Best regards,
    Ismael

    #1130473

    Hmm. that came up with some other issues.
    1. It only runs my custom filter/function on the most recent post (in loop and on single post), the others use default behavior.
    2. It shows the title twice and I get a weird '> in between the duplicated titles.

    Trying to troubleshoot code, but I’m just copying and pasting the exact code from avia to my custom function with the same modifications and remove/add filter.

    I’ll keep diggings.
    Any thoughts?

    Thanks again for your help.

    #1131141

    Hi,

    Thank you for the update.

    Try to set the priority of the new filter from “10” to “100”. That should override the default filter. Change this line:

    add_filter( 'post-format-link', 'avia_link_content_filter_mod', 10, 1 );
    

    .. to:

    add_filter( 'post-format-link', 'avia_link_content_filter_mod', 100, 1 );
    

    Best regards,
    Ismael

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