Example #1
0
/**
 * Return the ticker
 *
 * @since 2.0.9
 */
function get_mtphr_dnt_ticker($id = '', $class = '', $atts = false)
{
    /*
    	// Get the current mode for the ticker
    	$mode = ( is_array($atts) && isset($atts['mode']) ) ? $atts['mode'] : get_post_meta( $id, '_mtphr_dnt_mode', true );
    	
    	// Return the appropriate ticker mode
    	if( function_exists('render_mtphr_dnt_'.$mode.'_ticker') ) {
    		return call_user_func( 'render_mtphr_dnt_'.$mode.'_ticker', $id, $class, $atts );
    	} else {
    		return render_mtphr_dnt_ticker( $id, $class, $atts );
    	}
    */
    //$ticker = new MTPHR_DNT();
    // Check for WPML language posts
    $id = function_exists('icl_object_id') ? icl_object_id($id, 'ditty_news_ticker', true) : $id;
    // Get the current mode for the ticker
    $mode = is_array($atts) && isset($atts['mode']) ? $atts['mode'] : get_post_meta($id, '_mtphr_dnt_mode', true);
    // Make sure the ticker exists and is published
    $ticker = get_post($id);
    if ($ticker && $ticker->post_status == 'publish') {
        global $mtphr_dnt_meta_data;
        // Store all the custom fields in a metadata array
        $custom_fields = get_post_custom($id);
        $meta_data = array();
        foreach ($custom_fields as $key => $value) {
            $meta_data[$key] = maybe_unserialize($value[0]);
        }
        // Override meta data with supplied attributes
        if (is_array($atts)) {
            foreach ($atts as $key => $value) {
                $meta_data["_mtphr_dnt_{$key}"] = $value;
            }
        }
        // Return the appropriate ticker mode
        if (function_exists('render_mtphr_dnt_' . $mode . '_ticker')) {
            return call_user_func('render_mtphr_dnt_' . $mode . '_ticker', $id, $class, $meta_data);
        } else {
            return render_mtphr_dnt_ticker($id, $class, $meta_data);
        }
    }
}
Example #2
0
/**
 * Return the ticker
 *
 * @since 1.5.0
 */
function get_mtphr_dnt_ticker($id = '', $class = '', $atts = false)
{
    /*
    	$ajax = get_post_meta( $id, '_mtphr_dnt_ajax', true );
    	
    	if( $ajax || (isset($atts['ajax']) && $atts['ajax' == 1]) ) {
    		
    		$unique_id = get_post_meta( $id, '_mtphr_dnt_unique_id', true );
    		
    		// Add a unique id
    		$tick_id = 'mtphr-dnt-'.$id.'-ajax';
    		if( $unique_id != '' || (isset($atts['unique_id']) && ($atts['unique_id'] != '')) ) {
    			$tick_id = 'mtphr-dnt-'.$id.'-'.sanitize_html_class( $_mtphr_dnt_unique_id ).'-ajax';
    		}
    		
    		return '<div id="'.$tick_id.'" class="mtphr-dnt-ajax">Placeholder</div>';
    		
    	} else {
    	
    		return render_mtphr_dnt_ticker( $id, $class, $atts );
    	}
    */
    return render_mtphr_dnt_ticker($id, $class, $atts);
}