Add via or source text on posts loop

Posted in: Newspaper
Post count: 11

Hi,

I want to add on the posts loop block under the title and next to the image the source or the via of the article.

Can you please guide me through?

Regards,

Eric

Post count: 20688

Hi,

The modules do not display the source and via fields, those will appear only in the single post page.
There is a topic in which through some modifications in the theme files this is done
https://forum.tagdiv.com/topic/source-doesnt-work-after-update/

But this may not work for the modules used by the cloud library plugin, only for the default theme modules
https://www.screencast.com/t/xaJaJCkzV6eS

Thanks

Post count: 11

Hi Simion,
Thank you very much for the info.
I actually made it work inside the tdb_module_loop.php and the page displays the Source.

I added this function:

function get_source_and_via() {
        $buffy ='';
 
        //via and source
        if (!empty($this->td_review['td_source']) && !empty($this->td_review['td_source_url'])) {
            $source_url = $this->td_review['td_source_url'];
 
            $buffy .= '<div style="margin-top:10px;" class="td-post-small-box"><span>' . __td('SOURCE', TD_THEME_NAME) . '</span><a rel="nofollow" href="' . esc_url($source_url) . '">' . $this->td_review['td_source'] . '</a></div>';
        }
        return $buffy;
    }

How can I display only the via and not the source?

Thank you!

  • This reply was modified 7 years by erick485.
Post count: 20688

Hi,

While it is possible to do it, note that this modifications will have to be made after each theme update, the plugins will need updating.

I have tested the code in my end, it displays only the source, no via
http://prntscr.com/lwcycb
So that would be what you wanted.

Thanks

Post count: 11

Thank you Simion,

I want to display the via not the source. Which code should I use to display the td_via and td_via_url ?

I know that I will have to modify it in each update, but my client needs it.

Thank you!

Post count: 20688

Hi,

Sorry for misunderstanding, change the code like this
https://pastebin.com/xxaXebNm
Result here – http://prntscr.com/lwhp73

Thanks

Post count: 11

Works perfectly!

Thank you very much!

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newspaper’ is closed to new topics and replies.