Example #1
0
/**
 * Display custom columns for RSS Feeds
 *
 * @param $column
 * @param $post_id
 */
function rssmi_show_custom_columns($column, $post_id)
{
    global $wpdb;
    switch ($column) {
        case 'url':
            $url = get_post_meta($post_id, 'rssmi_url', true);
            echo '<a href="' . esc_url($url) . '">' . esc_url($url) . '</a>';
            break;
        case 'category':
            $category = get_post_meta($post_id, 'rssmi_cat', true);
            echo esc_html(wp_getCategoryName($category));
            break;
        case 'bloguser':
            $bloguser = get_post_meta($post_id, 'rssmi_user', true);
            $bloguser = (int) $bloguser;
            echo esc_html(get_userdata($bloguser)->display_name);
            break;
        case 'feeditems':
            $post_count = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM (SELECT * from {$wpdb->postmeta} as a inner join {$wpdb->posts} as b on b.id=a.post_id where meta_key='rssmi_item_feed_id' and meta_value=%d order by post_id desc LIMIT 25) as c order by post_id ASC", $post_id));
            echo $post_count;
            break;
        case 'lastupdate':
            if (get_post_meta($post_id, 'rssmi_last_update', true) != '') {
                $last_update = get_post_meta($post_id, 'rssmi_last_update', true);
                echo get_date_from_gmt(date('Y-m-d H:i:s', $last_update), 'M j, Y @ g:i a  ');
            } else {
                echo "No Recent Update Yet";
            }
            break;
        case 'ID':
            echo $post_id;
            break;
    }
}
Example #2
0
    }
    if (!empty($items["mydesc"]) && $showDesc == 1) {
        if ($showmore == 1 && $showDesc == 1) {
            $readable .= '<div id="' . $idnum . '" style="display:none" class="show_body">';
        } else {
            $readable .= '<div class="body">';
        }
        $readable .= showexcerpt($items["mydesc"], $descNum, $openWindow, $stripAll, $items["mylink"], $adjustImageSize, $float, $noFollow, $items["myimage"], $items["mycatid"], $stripSome, $useMediaImage);
        $readable .= '</div>';
    }
    if (!empty($items["mystrdate"]) && $showdate == 1) {
        // $readable .=  '<span style="'.$datestyle.'">'. date_i18n("D, M d, Y g:i:s A",$items["mystrdate"]).'</span><br />';  // use this instead if you want time to show
        $readable .= '<span class="date" style="' . $datestyle . '">' . date_i18n($strDate, $items["mystrdate"]) . '</span><br />';
        //	$readable .=  '<span class="date" style="'.$datestyle.'">'. getDateSince($items["mystrdate"],time()).'</span><br />';  // use this to show published how long ago
    }
    if (!empty($items["myGroup"]) && $showgroup == 1) {
        $readable .= '<span class="source" style="font-style:italic;">' . $attribution . '' . $items["myGroup"] . '</span>';
    }
    $getCatName = wp_getCategoryName($items["mycatid"]);
    // use these 5 lines of code to get and display the category name
    if (!empty($getCatName) && $showcategory == 1) {
        $catClassID = 'classID' . $items["mycatid"];
        $readable .= '  <span class="categoryname  ' . $catClassID . '">Category: ' . $getCatName . '</span>';
    }
    if ($showsocial == 1) {
        $readable .= '  <span class="socialicons"><a href="http://www.facebook.com/sharer/sharer.php?u=' . $items["mylink"] . '"><img src="' . WP_RSS_MULTI_IMAGES . 'facebook.png"/></a>&nbsp;&nbsp;<a href="http://twitter.com/intent/tweet?text=' . rawurlencode($items["mytitle"]) . '%20' . $items["mylink"] . '"><img src="' . WP_RSS_MULTI_IMAGES . 'twitter.png"/></a>&nbsp;&nbsp;<a href="http://plus.google.com/share?url=' . rawurlencode($items["mylink"]) . '"><img src="' . WP_RSS_MULTI_IMAGES . 'gplus.png"/></a>&nbsp;&nbsp;<a href="http://www.linkedin.com/shareArticle?mini=true&url=' . rawurlencode($items["mylink"]) . '"><img src="' . WP_RSS_MULTI_IMAGES . 'linkedin.png"/></a></span>';
    }
    $readable .= '</div>';
}
$readable .= '</div>';
//  This is the end of the default template