Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #424366

    I have a number of blog posts in this site where the post format in set to “Link.” When I call these posts into the sidebar using the “ENFOLD Latest News” widget I want the hyperlink on these to go directly to the link, NOT the blog post where the title is the link. Some of these are pdfs and others are external URLs. This is an extra step and its redundant for this site.

    #424823

    Hi stupaul22!

    The file your looking for is /enfold/framework/php/class-framework-widgets.php and around line 500 you could add something like this to change the URL for the link format.

    if ( $format == 'link' ) { $link = "test"; }
    

    I’m not sure if WordPress has a function for finding the link you set for the post though. I found this, https://wordpress.org/support/topic/how-to-make-use-of-the-post-format-link. You could try using that to parse the URL from the post and then set the link manually.

    Best regards,
    Elliott

    • This reply was modified 9 years, 7 months ago by Elliott.
    #425580

    Thank you Elliott,

    I put the code into /enfold/framework/php/class-framework-widgets.php on line 501. The “latest news” sidebar widget links now pull in the URL of the page you are on, plus the string”test” like so:
    http://newsite.cvreps.com/manufacturers/test
    See:
    http://newsite.cvreps.com/manufacturers/

    Unfortunately the code from the WordPress forum “https://wordpress.org/support/topic/how-to-make-use-of-the-post-format-link” is a bit too difficult for me to implement.

    Could someone please help me to integrate the code? I need to parse the URL link from the (link format) post, and insert it at “test.” Also the URL of the page, “manufactures” in previous example, would need to go away.

    Thank for any help on this.

    #425796

    Hey!

    Could you please provide us with a temporary admin login so that we can take a closer look? You can post the details here as a private reply.

    Best regards,
    Rikard

    #425986
    This reply has been marked as private.
    #426179
    This reply has been marked as private.
    #426885

    Hey!

    Alright. Please edit framework > php > class-framework-widgets.php. Find this code on line 497:

    $link = get_post_meta( $the_id  ,'_portfolio_custom_link', true) != "" ? get_post_meta( $the_id ,'_portfolio_custom_link_url', true) : get_permalink();
    

    Below, add this code:

    if($format == 'link')
                                               {
                                                    $current_post = array();
                                                    $current_post['content'] = get_the_content();
                                                    $current_post['title'] =  get_the_title();
                                                    
                                                    if(function_exists('avia_link_content_filter'))
                                                    {
                                                        $current_post = avia_link_content_filter($current_post);
                                                    }
                            
                                                    $link = $current_post['url'];
                                                }

    Cheers!
    Ismael

    #427088
    This reply has been marked as private.
    #427090

    One last question.
    Where would I put:
    target="_blank"
    So that the post format link opens in a new window?
    Possible?

    #427101
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Post format "Link" links direct in latest news widgit’ is closed to new replies.