marcellodj
Member
Posted 3 years ago #
Hello, i m running a feed aggregator using wp+feedwp; so i have a lot of articles pulled into my db from external sites.
All permalinks points to content of my site not to original article, so i would to ad in top or at the end of each article a Link eg "Read original story" that points to original article of external site: i see in my db that there is a meta_key named syndication_permalink that is the original url of article: how i can use it to display the desidered link? i know at moment only the function the_meta() but it displays a raw list of all metadatas.
Any help will be appreciated.
If your Loop in your page template try this:
<?php
$link = get_post_meta($post->ID, 'syndication permalink', true);
if ($link){
echo '<a href="'.$link.'">Read original story</a>';
}
?>
marcellodj
Member
Posted 3 years ago #
Thanks Michael it works ! but with this mod:
syndication permalink = syndication_permalink
i think you have mistyped the field name.
So the full code to show the link to original article from the rss source will be:
<?php
$link = get_post_meta($post->ID, 'syndication_permalink', true);
if ($link){
echo '<a href="'.$link.'">Read original story</a>';
}
?>
I placed it in single.php after <?php the_content(); ?> .
Hope this help anyone in the same trouble.
Actually we can use the following code:
<a href="<?php the_syndication_permalink() ?>">Read original story</a>
But,No matter what code, Some URL will be wrong.
For example,
The syndication permalink is aaa.com/bbb/xxxx/
The link in my page is kekeguoguo.com/bbb/xxxx/
Of course ,I thinking of the httpd.ini.But I dont know how to fix it.
enquirer32
Member
Posted 2 years ago #
Code from marcellodj works fine. How do you get this to open on a new page?
enquirer32
Member
Posted 2 years ago #
I now can't get either of these to work and probably if I did it was a fluke. Can anyone help here?