Hello,
We are using your NewsPaper theme (v7) in our news website and we noted that when a youtube link is inserted that gets auto embedded (via the WordPress oEmbed) that the link stays in the generated excerpt.
I’m the developer responsible for the site and I noticed that you have a function called “excerpt” – inside td_utils that is responsible for generating the excerpt and I also noted that inside that function that you are already removing any variation of the link.
Is there any way for me to access/override/hook to that function or the excerpt creation itself without having to edit parent theme file? I’m using your provided child theme and all edits are being done that way.
My end end goal is to override that function with something like
$post_content = strip_tags(strip_shortcodes($post_content));
# ... rest of the code that trims the excerpt already in your function ...
Thanks in Advance.
-
This topic was modified 9 years by
di_aeiou.
Hi,
Unfortunately you cannot overwrite this file from child theme. Also you can find there a code to remove the youtube links from excerpt just uncomment it and see how it goes – http://screencast.com/t/RYNat3pc
We did not implemented yet, but the tested code is there. We will try to make more test in this regard.
Another solution would be to add the excerpt manually to your articles – http://screencast.com/t/mtJF1mvygm7
Thanks!
Hello again.
I found that code in the theme files and if there is no other option for now I will have to remove the comment from that code until a future update enables this override.
If I may suggest, in this scenario (and others like it) where a methods are being called statically and by design not overridable in via the child theme, you could add some custom action/filter hooks (via do_action/apply_filter) to allow for customization of the content. That way threads like mine would be more easily responded to since I found quite a few around.
Thanks.
-
This reply was modified 9 years by
di_aeiou.
Hi,
I can only to add your request on our list and the developers will consider if they can change the code or find another workaround in future.
Thanks!
Hi, I’m in the same boat as di_aeiou. Youtube links are displaying in excerpts which look ugly. The fix for this is commented out in td_util.php and seems to work for us:
$post_content = preg_replace('~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@?&%=+\/\$_.-]*~i', '', $post_content);
Unfortunately there doesn’t appear to be a way to implement it in a child theme.
I am having the same issue it would be great if you guys would implement this fix in an update.. there is no reason anyone would want a txt url as the description.. it looks terrible..
//to make matters worse, if I write a description and place it under the embed the txt url displays as the description… forcing me to have to put text above video embeds… PLEASE fix this in an update.
-
This reply was modified 6 years by
BuddhaNET777.
-
This reply was modified 6 years by
BuddhaNET777.
Hi BuddhaNET777,
You can use the excerpt, in this way the link will not be display -> https://forum.tagdiv.com/excerpts-introduction/ if you want to remove it from auto excerpt -> wp-content/plugins/td-composer/legacy/common/wp_booster/td_util.php
Also I will note this suggestion.
Thank you!