/**
 * Function to retrive most downloaded software list for the home page
 *
 * @return array
 *
 */
function get_top_downloads_home()
{
    $limit = 5;
    $json_path = ABSPATH . "../top.json";
    $baixades_json = json_decode(file_get_contents($json_path));
    $programari = array();
    if ($baixades_json) {
        foreach ($baixades_json as $key => $operating_system) {
            $programari[$key] = array();
            $i = 0;
            foreach ($operating_system as $pkey => $program) {
                if ($i < $limit) {
                    $link = get_program_link($program);
                    if ($link) {
                        $programari[$key][$pkey]['title'] = wp_trim_words(str_replace('_', ' ', get_the_title($program->wordpress_id)), 8);
                        $programari[$key][$pkey]['link'] = $link;
                        $programari[$key][$pkey]['total_downloads'] = $program->total;
                    }
                    $i++;
                }
            }
        }
    }
    return $programari;
}
예제 #2
0
function write_sexy_program_header($type)
{
    //    die($type);
    $args = array('orderby' => 'date', 'order' => 'ASC', 'post_count' => -1, 'post_type' => 'program', 'tax_query' => array(array('taxonomy' => 'program-type', 'field' => 'slug', 'terms' => array($type))));
    $myposts = get_posts($args);
    //    die($myposts);
    foreach ($myposts as $mypost) {
        $fields = get_post_custom($mypost->ID);
        //                        die($fields['active'] );
        if ($fields['active'][0] == 'Active' && $fields['all'][0] != 1) {
            $description = $fields['program-description'][0];
            $exec = $fields['coordinator-name'][0];
            $message = $fields['coordinator-message'][0];
            $program_title = $fields['title'][0];
            $subtitle = $fields['subtitle'][0];
            //            die(var_dump($fields['coordinator-name'][0]));
            echo ' 
            <div class="about-program"><!-- full width section-->
                <div class="container">
                    <div class="row">
                        <div class="col-md-12 ">
                            <div class="panel-pane pane-block pane-block-6 cbb-home-block cbb-home-block-left">
                                <div class="pane-content">
                                    <div class="program-top-home">
                                        <p class="more-link"><a href = "javascript:void(0)" onclick = "document.getElementById(\'light\').style.display=\'block\';document.getElementById(\'fade\').style.display=\'block\'">Sign Up Now</a></p>
                                        <div class="container"><div class="row clearfix"><div id="light" class="white_content col-xs-8 col-xs-offset-2"><a href = "javascript:void(0)" onclick = "document.getElementById(\'light\').style.display=\'none\';document.getElementById(\'fade\').style.display=\'none\'"><i class="fa fa-times"></i></a>' . get_program_link($type) . '</div></div></div>
                                        <h2>' . $program_title . '</h2>
                                        <p>' . $subtitle . '</p>
                                        <p>' . $description . '</p>
                                    </div>
                                    <div class="program-bottom-home">
                                        <div class="row">
                                            <div class="col-sm-12">
                                                <div class="row">
                                                    <div class="col-sm-4">
                                                        ';
            echo write_sexy_exec_info($fields['coordinator-name'][0]);
            echo '                                        </div>
                                                    <div class="col-sm-8">
                                                        <div class="program-bottom-home-inner-right">
                                                            <h3>Message from the Coordinator</h3>
                                                            <p>' . $message . '</p>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>  
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>';
            break;
        }
    }
}