getdave / Tanlinell

Boilerplate Wordpress theme for rapid development of new WP themes. Based on the great work of the _s ("Underscore") theme.
GNU General Public License v2.0
6 stars 2 forks source link

Create Instagram social-feed partial #248

Closed neilberry001 closed 10 years ago

neilberry001 commented 10 years ago

social-feed--instagram.php

<?php
/**
 * Instagram Feed 
 */
?>
<?php

    $instagram = get_transient("instagram");  

    if ( false == $instagram ) {  

        $token = 'YOUR TOKEN HERE';
        $count = 9;
        $url = "https://api.instagram.com/v1/users/self/media/recent?access_token=". $token ."&count=". $count;

        $data = file_get_contents($url);

        if ($data) {

            set_transient("instagram", $data, 60 * 60 * 1); // Stored for one hour
            $instagram = $data;  

        }
    }

    $instagram = json_decode($instagram);

?>

<?php if ( false != $instagram->data ) : ?>

<?php $custom_posts_loop_count = 0; ?>

<ul class="inline-list">
    <?php foreach( $instagram->data AS $image ) : ?>

        <li class="<?php echo ++$custom_posts_loop_count; ?><?php echo ($custom_posts_loop_count > 4) ? ' hidden-medium hidden-small hidden-tiny' : ''; ?>">
            <a href="<?php echo esc_url( $image->link ); ?>" title="'.<?php echo esc_attr( $image->caption->text ); ?>.'">
                <img src="<?php echo esc_url( $image->images->thumbnail->url ); ?>" alt="">
            </a>
        </li>

    <?php endforeach; ?>
</ul>
<?php endif; ?>

Consider social-feed--twitter.php update

neilberry001 commented 10 years ago

Cancel this. Social feeds are not provided out of the box.

@getdave maybe this is an avenue for development, i know there are many dependencies for each social network, plugins, funcitons. Maybe best to add on case by case as we do now.

fyi i started this ticket

getdave commented 10 years ago

@neilberry001 Maybe have an "addons" or "extensions" which aren't enabled by default. Or create a Plugin or...

getdave commented 10 years ago

Is this now redundant @neilberry001 ?

neilberry001 commented 10 years ago

no but we dont do it for every site and its dependant on a plugin so lets just keep it case by case until i have time to create our own awesome plugin, cheers