Friday

Drupal7 - Add source to feed item - Feed module -


Feed item doesn't show a link to the  source article (in the original website), to add a link to the source  (to view a full article) do the following steps:

1- add a new field to the content type: Feed Item (field_source)
2- go to Structure --> feed imporer

then

 Feed ...... override/Edit 


Node processor--->>> mapping



Add:
source: Item URL (link)
Target : feild_source


3- the link will be printed as a text in the feed item node, to print it as a link:
open: node.tpl.php

first hide this field :

 hide($content['comments']);
 hide($content['field_source']);
 hide($content['links']);
 print render($content);

and then print it as following:

<?php 

$t=str_ireplace('<div class="field field-name-field-source field-type-text field-label-hidden">', '', render($content['field_source']));

$t2=str_ireplace('<div class="field-item even">', '', $t);

$t3=str_ireplace('</div>', '', $t2);

print '<a href='.$t3.'>Source </a>';?>

  <?php if ($content['links']): ?>