-
AuthorPosts
-
April 7, 2015 at 12:56 am #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.
April 7, 2015 at 5:03 pm #424823Hi 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, 6 months ago by Elliott.
April 8, 2015 at 8:48 pm #425580Thank 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.
April 9, 2015 at 10:19 am #425796Hey!
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,
RikardApril 9, 2015 at 3:24 pm #425986This reply has been marked as private.April 9, 2015 at 8:41 pm #426179This reply has been marked as private.April 11, 2015 at 5:00 am #426885Hey!
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!
IsmaelApril 11, 2015 at 10:27 pm #427088This reply has been marked as private.April 11, 2015 at 11:02 pm #427090One last question.
Where would I put:
target="_blank"
So that the post format link opens in a new window?
Possible?April 12, 2015 at 12:49 am #427101This reply has been marked as private. -
AuthorPosts
- The topic ‘Post format "Link" links direct in latest news widgit’ is closed to new replies.