How do I show only the external source link on a single post page unsing AutoBlog Plugin.

Hello!

I'm using AutoBlog Plugin.

I set the plugin to get feeds from many websites and I added a phrase like that: See Full post to be filled with the link to the website the content is coming from.

Autoblog has a function that gets the content of a post and append the external source link after each post on the single post page view with the phrase I set up when I created the entry.

My question is. If I want to only show on my single post page view the link of this external source what would be the php tag I can use to display it?

Is there a way to have a tag that will only show the external source link so I can manipulate it instead of having it automatically added at the end of each post?

To make sure you can help me, this is the function I found on this file: autoblogincludes/classes/autoblogprocess.php

// This function appends the source to the bottom of the content if it exists.
function append_original_source( $content ) {

global $post;

if(empty($post)) {
return $content;
}

$source = get_post_meta( $post->ID, 'original_source_link_html', true );
if(!empty($source)) {
$content .= "<p>" . $source . "</p>";
}

return $content;

}

What I want is, something like this:

get_post_meta( $post->ID, 'original_source_link_html', true );

that I can place inside my singlepage.php and have only this link appearing.... or even just echo the url so I can manipulate it the way I want.

Thanks.

  • caiocall

    Hello, thanks for your help but It's not exactly the solution I need.

    What I need is something like: <php get_source_link(); ?>

    A code like that, that when I place it into my singlepostpage.php inside the loop then it will generate the http://external_link_source_url.com/ OR the link "See full post"

    then I can place it manually after <php the_content(); ?> for instance. and change the function instead of appending it automatically I want a code that purelly generates that url so i can place it anywhere I want and do anything with it....

    Is that clear? I can try to explain again if not... let me know please.

  • caiocall

    Ah just to make you understand better....

    This function append the link to the_content, right?

    The thing is, I'm not using the_content on my single post page because I'm customizing it getting each element separated, so as I will not have the_content this link will simply not appear, but I still want to have the link and have it separated so i can generate it through the php tag and manipulate it...

    So imagine that, for each post I have, when users are inside the single page how can I get the external link source only and display it? Or lets say, I want to get the external source link of each post and show it inside the loop, how do I do that?

    That's what I need!

  • aristath

    Well, I get what you want to do but the problem is I don't know how it can be done!
    By default the URL is generated when the post is first published.
    If you don't want to save it in the content, you'll have to create a custom field ans save it there! That's the only way I can think of doing it...
    And then use your custom function to display the value of that field.

    I hope that helps...

    Cheers,
    Ari.

  • caiocall

    Can you try to find someone who can help me? I'm pretty sure there's a way to achieve what I need.

    The url is appended to the post, so it's not being included inside the post, it's being included by the function, for example if I go to the post generated by autoblog plugin I can't see the external link on the post content inside the edit text area, so it's coming from another place, what I want Is just the function that places it anywhere I want according to the post the users is at the moment.

    Instead of appending the url/link to the post when its generated I want to have only the url not attached or appended to the main content, that's all.

    Can someone please help?

  • aristath

    You're right, the source is already in a custom field!

    You can add this in your theme's functions.php:

    function custom_post_original_link() {
      $source = get_post_meta( $post->ID, 'original_source_link_html', true );
      if(!empty($source)) {
      echo $source;
    }

    Then, you can use this to display the post's original URL wherever you want:
    <?php custom_post_original_link(); ?>
    OR you can do it like this, skipping the function:
    <?php global $post; echo get_post_meta( $post->ID, 'original_source_link_html', true ); ?>

    disable auto-posting the original URL into post's content, try adding this in your theme's functions.php:

    global $autoblogcron;
    remove_filter( 'the_content', array($autoblogcron, 'append_original_source'), 999, 1 );

    I haven't tried this but is should work...

    Please let me know if that helps!

    Cheers,
    Ari.

  • caiocall

    Ok, I've tried this:

    function custom_post_original_link() {
      $source = get_post_meta( $post->ID, 'original_source_link_html', true );
      if(!empty($source)) {
      echo $source;
    }

    and this generates an error while I place it inside my functions.php. I'm not sure why. Must be missing something, maybe it's because its calling something from the plugin inside the function that is a separated file so it won't recognize the variables or values the function is requesting.... maybe make it global like the link?

    the second I tried was this line inside the singlepost.php inside the loop:

    <?php global $post; echo get_post_meta( $post->ID, 'original_source_link_html', true ); ?>

    and this works to generate the link "See full post" perfectly!

    It is generating the phrase already as a link.

    One question, is there a way to generate the URL only? so I could place it inside an actual link? like

    <a href="THE_CODE_HERE">mylink</a>

    I haven't tested or used this as I didn't see fit for my needs:

    global $autoblogcron;
    remove_filter( 'the_content', array($autoblogcron, 'append_original_source'), 999, 1 );

    just saying to help others in case someone is reading this...

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.