Viewing 11 posts - 1 through 11 (of 11 total)
  • Posted in: Uplift
  • #292499
    davidll
    Member
    Post count: 205

    Hello

    Is it possible you can help me…

    I use the SF tweet feed on a few sites. All works great, perfect. As the screenshot attached – for this example i’ve used Neighborhood – please see Neighborhood.jpg

    You get the twitter bird, the tweet, icons and time stamp and then a space and the next tweet – and I can also review this in latest-tweets.php. Lovely.

    With Uplift its a different, odd order? – please see uplift.jpg
    First you get the Icons ??
    Second get the twitter account name (repeated after every tweet??)
    Thrid, the tweet

    and then it repeats – but the icons on the next tweet is so easily confusing and feels like it belongs to the tweet above.

    Also, I can’t find any reference to latest-tweets.php in uplift?

    Can I ask if the UX seems odd to you? (or is it just be)… can you point me in the right direction to fix the order?

    Many thanks

    David

    Attachments:
    You must be logged in to view attached files.
    #292638
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You can find the latest-tweets.php file at plugin /swift-framework/includes/page-builder/shortcodes/.
    Thanks
    Mohammad

    #292647
    davidll
    Member
    Post count: 205

    Hello

    Im sorry – but thats incorrect for Uplift.
    I’ve just downloaded another version from Themeforest – and uplift DOES NOT have this directory.

    Can you please check again

    David

    #292651
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Its under the /wp-content/plugins/Swift-framework/.
    Thanks
    Mohammad

    #292657
    davidll
    Member
    Post count: 205

    and…
    includes / page-builder / shortcodes / latest-tweets.php

    I guess you don’t want to comment on the order? and why its changed?

    #292665
    davidll
    Member
    Post count: 205

    Ok – I can’t find where i can edit the order?

    Can I ask this question in another way – is there a simple way to make the Uplift tweeter feed like all your other themes?

    Thanks

    #292692
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme and edit

    
        function sf_get_tweets( $twitterID, $count, $type = "", $item_class = "col-sm-4" ) {
    
                $sf_options = sf_get_theme_opts();
                $enable_twitter_rts = false;
                if ( isset( $sf_options['enable_twitter_rts'] ) ) {
                    $enable_twitter_rts = $sf_options['enable_twitter_rts'];
                }
    
                $content         = "";
                $blog_grid_count = 0;
    
                if ( function_exists( 'getTweets' ) ) {
    
                    $options = array(
                        'trim_user'       => true,
                        'exclude_replies' => false,
                        'include_rts'     => $enable_twitter_rts
                    );
    
                    $tweets = getTweets( $twitterID, $count, $options );
    
                    if ( is_array( $tweets ) ) {
    
                        if ( isset( $tweets["error"] ) && $tweets["error"] != "" ) {
    
                            return '<li>' . $tweets["error"] . '</li>';
    
                        } else {
    
                            foreach ( $tweets as $tweet ) {
    
                                if ( $type == "blog-grid" ) {
    
                                    $content .= '<li class="blog-item '.$item_class.' tweet-item" data-date="' . strtotime( $tweet['created_at'] ) . '" data-sortid="' . $blog_grid_count . '">';
                                    $content .= '<a class="grid-link" href="https://twitter.com/' . $twitterID . '/status/' . $tweet['id_str'] . '" target="_blank"></a>';
                                    $content .= '<div class="grid-no-image">';
                                    $content .= '<div class="details-inner">';
    
                                    $blog_grid_count = $blog_grid_count + 2;
    
                                } else if ( $type == "blog" ) {
    
                                    $content .= '<li class="blog-item tweet-item ' . $item_class . '" data-date="' . strtotime( $tweet['created_at'] ) . '">';
                                   	$content .= '<div class="details-wrap clearfix">';
                                   	$content .= '<div class="details-inner">';
    
                                } else if ( $type == "blog-fw" ) {
    
                                    $content .= '<li class="blog-item tweet-item ' . $item_class . '" data-date="' . strtotime( $tweet['created_at'] ) . '">';
                                    $content .= '<div class="details-wrap clearfix">';
                                   	$content .= '<div class="details-inner">';
    
                                } else {
    
                                    $content .= '<li>';
    
                                }
    
                                if ( isset( $tweet['text'] ) && $tweet['text'] ) {
                                	
                                    // 3. Tweet Actions
                                    //    Reply, Retweet, and Favorite action icons must always be visible for the user to interact with the Tweet. These actions must be implemented using Web Intents or with the authenticated Twitter API.
                                    //    No other social or 3rd party actions similar to Follow, Reply, Retweet and Favorite may be attached to a Tweet.
                                    // 4. Tweet Timestamp
                                    //    The Tweet timestamp must always be visible and include the time and date. e.g., "3:00 PM - 31 May 12".
                                    // 5. Tweet Permalink
                                    //    The Tweet timestamp must always be linked to the Tweet permalink.
    
                                   
    
                                    if ( $type == "blog" || $type == "blog-grid" || $type == "blog-fw" ) {
                                        $content .= '<h3 class="tweet-text">';
                                    } else {
                                        $content .= '<div class="tweet-text slide-content-wrap">';
                                    }
    
                                    $the_tweet = apply_filters( 'sf_tweet_text', $tweet['text'] );
    
                                    /*
                                    Twitter Developer Display Requirements
                                    https://dev.twitter.com/terms/display-requirements
    
                                    2.b. Tweet Entities within the Tweet text must be properly linked to their appropriate home on Twitter. For example:
                                      i. User_mentions must link to the mentioned user's profile.
                                     ii. Hashtags must link to a twitter.com search with the hashtag as the query.
                                    iii. Links in Tweet text must be displayed using the display_url
                                         field in the URL entities API response, and link to the original t.co url field.
                                    */
    
                                    // i. User_mentions must link to the mentioned user's profile.
                                    if ( isset( $tweet['entities']['user_mentions'] ) && is_array( $tweet['entities']['user_mentions'] ) ) {
                                        foreach ( $tweet['entities']['user_mentions'] as $key => $user_mention ) {
                                            $the_tweet = preg_replace(
                                                '/@' . $user_mention['screen_name'] . '/i',
                                                '<a href="http://www.twitter.com/' . $user_mention['screen_name'] . '" target="_blank">@' . $user_mention['screen_name'] . '</a>',
                                                $the_tweet );
                                        }
                                    }
    
                                    // ii. Hashtags must link to a twitter.com search with the hashtag as the query.
                                    if ( isset( $tweet['entities']['hashtags'] ) && is_array( $tweet['entities']['hashtags'] ) ) {
                                        foreach ( $tweet['entities']['hashtags'] as $key => $hashtag ) {
                                            $the_tweet = preg_replace(
                                                '/#' . $hashtag['text'] . '/i',
                                                '<a href="https://twitter.com/search?q=%23' . $hashtag['text'] . '&src=hash" target="_blank">#' . $hashtag['text'] . '</a>',
                                                $the_tweet );
                                        }
                                    }
    
                                    // iii. Links in Tweet text must be displayed using the display_url
                                    //      field in the URL entities API response, and link to the original t.co url field.
                                    if ( isset( $tweet['entities']['urls'] ) && is_array( $tweet['entities']['urls'] ) ) {
                                        foreach ( $tweet['entities']['urls'] as $key => $link ) {
    
                                            $link_url = "";
    
                                            if ( isset( $link['expanded_url'] ) ) {
                                                $link_url = $link['expanded_url'];
                                            } else {
                                                $link_url = $link['url'];
                                            }
    
                                            $the_tweet = preg_replace(
                                                '<code>' . $link['url'] . '</code>',
                                                '<a href="' . $link_url . '" target="_blank">' . $link_url . '</a>',
                                                $the_tweet );
                                        }
                                    }
    
                                    // Custom code to link to media
                                    if ( isset( $tweet['entities']['media'] ) && is_array( $tweet['entities']['media'] ) ) {
                                        foreach ( $tweet['entities']['media'] as $key => $media ) {
    
                                            $the_tweet = preg_replace(
                                                '<code>' . $media['url'] . '</code>',
                                                '<a href="' . $media['url'] . '" target="_blank">' . $media['url'] . '</a>',
                                                $the_tweet );
                                        }
                                    }
    
                                    $content .= $the_tweet;
    
                                    if ( $type == "blog" || $type == "blog-grid" || $type == "blog-fw" ) {
                                        $content .= '</h3>';
                                    } else {
                                        $content .= '</div>';
                                    }
    
                                     $content .= '<div class="twitter_intents clearfix">' . "\n";
                                    $content .= '<a class="reply" href="https://twitter.com/intent/tweet?in_reply_to=' . $tweet['id_str'] . '"><i class="fa-reply"></i></a>' . "\n";
                                    $content .= '<a class="retweet" href="https://twitter.com/intent/retweet?tweet_id=' . $tweet['id_str'] . '"><i class="fa-retweet"></i></a>' . "\n";
                                    $content .= '<a class="favorite" href="https://twitter.com/intent/favorite?tweet_id=' . $tweet['id_str'] . '"><i class="fa-star"></i></a>' . "\n";
    
                                    $date     = strtotime( $tweet['created_at'] ); // retrives the tweets date and time in Unix Epoch terms
                                    $blogtime = current_time( 'U' ); // retrives the current browser client date and time in Unix Epoch terms
                                    $dago     = human_time_diff( $date, $blogtime ) . ' ' . sprintf( __( 'ago', 'uplift' ) ); // calculates and outputs the time past in human readable format
                                    $content .= '<h3><a class="twitter-id" href="http://twitter.com/' . $twitterID . '" target="_blank">@' . $twitterID . '</a></h3>';
                                    $content .= '<a class="timestamp" href="https://twitter.com/' . $twitterID . '/status/' . $tweet['id_str'] . '" target="_blank">' . $dago . '</a>' . "\n";
                                    $content .= '</div>' . "\n";
    
                                } else {
                                    $content .= '<a href="http://twitter.com/' . $twitterID . '" target="_blank">@' . $twitterID . '</a>';
                                }
    
                                if ( $type == "blog" || $type == "blog-grid" || $type == "blog-fw" ) {
                                	
                                	$content .= '</div>';
                                	$content .= '<div class="blog-item-aux clearfix">';
                    	            $content .= '<data class="date" data-date="' . $date . '" value="' . $date . '">' . $dago . '</data>';
                    	            $content .= '<div class="author"><a class="tweet-link" href="https://twitter.com/' . $twitterID . '/status/' . $tweet['id_str'] . '" target="_blank"><span>@' . $twitterID . '</span></a></div>';
                                    $content .= '</div>';
                                    $content .= '</div>';
                                }
    
                                $content .= '</li>';
                            }
                        }
    
                        return $content;
    
                    }
                } else {
                    return '<li><div class="tweet-text">Please install the oAuth Twitter Feed Plugin and follow the theme documentation to set it up.</div></li>';
                }
    
            }

    Thanks
    Mohammad

    #292710
    davidll
    Member
    Post count: 205

    Thanks for the code – Its doesn’t work unfortunately (see screen shot).

    Does this originate from sf-functions.php?

    D

    Attachments:
    You must be logged in to view attached files.
    #292712
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Yes, its originated from sf-functions.php file.
    Thanks
    Mohammad

    #292774
    davidll
    Member
    Post count: 205

    Thanks Mohammad
    I’ve got the script working.

    Maybe worth pointing out for a future update?

    Thanks Again

    D

    #292780
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Glad 🙂 to know this.
    Thanks
    Mohammad

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

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register