test
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • matgray87 Friend
    #201656

    Hi,
    I am using the Social Feed plugin to bring in images from instagram into a category to be displayed here:
    http://annings.mattgraydesign.co.uk/gallery/
    When the content is imported from instagram, it comes with no date, as the information isn’t pulled in by the feed.
    When being pulled in, the most recent instagram post is still given the latest ID, but all the date information is the same.
    This is making it impossible for me to order the articles by date, so I need to order by ID, but that isn’t an option within the blog/portfolio layout.
    Where can I override the article ordering so that the latest ID comes first?
    Thanks,
    Matt

    Ninja Lead Moderator
    #550958

    You can customize createdate or id of Instagram in plugins/system/jasocial_feed/jasocial_feed.php file


    private function fetchInstagramPost ($profile) {
    $igid = $this->getProperty($profile, 'instagram_account');
    $target_com = $this->getProperty($profile, 'instagram_target', 'joomla');
    $tableContent = $this->getTable($target_com, 0);
    $catid = $this->getProperty($profile, 'instagram_'.$target_com.'_catid', 0);
    if(!$tableContent || !$igid || !$catid) {
    return false;
    }

    $created_by = $this->getProperty($profile, 'instagram_created_by', 42);
    $getImg = $this->getProperty($profile, 'instagram_getimg', 1);
    $srcTxt = $this->getProperty($profile, 'instagram_sourcetxt', '(Source Instagram)');
    $limit = $this->getProperty($profile, 'instagram_limit_post', 20);
    $update_article = $this->getProperty($profile, 'instagram_update_article', 0);

    //override global settings
    $this->save_image = $this->getProperty($profile, 'instagram_save_image', 0);
    $this->valid_img_width = $this->getProperty($profile, 'instagram_valid_img_width', 360);
    $this->valid_img_height = $this->getProperty($profile, 'instagram_valid_img_height', 180);

    //IMPORT PROCESS
    $igKey = $igid.'_';

    $last_insert_id = isset($this->aInfo[$igKey.'ig_last_id']) ? $this->aInfo[$igKey.'ig_last_id'] : '';

    $items = $this->getInstagramItems($igid, $limit);

    $numResult = 0;
    //$aResult = array();

    if(count($items)) {
    $i = 0;
    foreach ($items as $dt) {
    $i++;

    /*if($dt->id == $last_insert_id && !$update_article) {
    //remain posts are imported => skipable
    break;
    }*/

    $alias = JApplication::stringURLSafe('instagram-id-'.$dt->id);

    $oldId = $tableContent->existsPost($alias);
    if($oldId && !$update_article) {
    continue;
    }

    if($i == 1) {
    $this->aInfo[$igKey.'ig_last_id'] = $dt->id;
    }

    $title = $this->getPostTitle($dt->title);
    $tcontent = $dt->title;

    $post = array();
    $post['source_alias'] = $alias;
    $post['source_title'] = $title;
    $post['created_by'] = $created_by;
    $post['source_author'] = $dt->author;
    $post['catid'] = $catid;
    $post['source_published_date'] = $dt->pubDate;
    $post['source_url'] = $dt->link;
    $post['source_url_txt'] = $srcTxt;
    //images
    $post['source_images'] = $this->saveImage($dt->image, 'instagram', $title, $title);
    $post['source_content'] = $tcontent;

    $tableContent->store('instagram', $post, $oldId);
    //
    $numResult++;
    }
    }
    //return $aResult;
    $this->updateCacheInfo(0);
    return ;
    }

    or you can change ordering $this->item from blog/portfolio layout in templates/ja_sugite/html/com_content/category/portfolio_item.php file

    matgray87 Friend
    #551026

    The method that the social feed is using to create the ID/createdate is fine… I just can’t change the ordering of the actual articles when displayed as Portfolio layout.
    I’ve looked in the templates/ja_sugite/html/com_content/category/portfolio_item.php file, but can’t find anything to do with ordering…

    Where do I find that?

    Cheers

    Ninja Lead Moderator
    #551054

    @matgray87: You can change ordering array object in templates/ja_sugite/html/com_content/category/portfolio.php file with $this->lead_items and $this->intro_items

    matgray87 Friend
    #551174

    Hi,
    Forgive me if i’m being naive, but what do I need to change it to to get it to order the articles by ID… I can’t see anything to do with the ordering here:

    <?php if (empty($this->lead_items) && empty($this->link_items) && empty($this->intro_items)) :
    if ($this->params->get('show_no_articles', 1)) : ?>
    <p><?php echo JText::_('COM_CONTENT_NO_ARTICLES'); ?></p>
    <?php endif; ?>
    <?php endif; ?>

    <?php $leadingcount = 0; ?>
    <?php if (!empty($this->lead_items)) : ?>
    <?php foreach ($this->lead_items as &$item) : ?>
    <?php
    $this->item = &$item;
    echo $this->loadTemplate('item');
    ?>
    <?php $leadingcount++; ?>
    <?php endforeach; ?>
    <?php endif; ?>

    <?php
    $introcount = (count($this->intro_items));
    $counter = 0;
    ?>

    <?php if (!empty($this->intro_items)) : ?>
    <?php foreach ($this->intro_items as $key => &$item) : ?>
    <?php $rowcount = ((int) $counter % (int) $this->columns) + 1; ?>
    <?php
    $this->item = &$item;
    echo $this->loadTemplate('item');
    ?>
    <?php $counter++; ?>

    <?php endforeach; ?>
    <?php endif; ?>

    What do I need to add? Don’t I need to change something in the relevant menu?
    Thanks

    Ninja Lead Moderator
    #551308

    Here is code to help you order by article ID in portfolio.php file


    1. ordering_by_id
    matgray87 Friend
    #551721

    Thanks, had to change it to arsort so that it went in the opposite order instead… but all good, and now sorted… thanks!

Viewing 7 posts - 1 through 7 (of 7 total)

This topic contains 7 replies, has 2 voices, and was last updated by  matgray87 10 years, 3 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum