コード例 #1
0
/**
 * setup pods 
 */
function sdm_pods_init_action()
{
    if (!function_exists('pods')) {
        return;
    }
    $settingsPod = pods('kc_settings');
    if ($settingsPod) {
        KC::$copyright = $settingsPod->field('copyright');
        KC::$author_slug = $settingsPod->field('authors_slug');
        KC::$default_header_image = PodUtils::getImgUrl($settingsPod, 'default_header_image', 'full');
    }
    // SCHEMA
    $schemaPod = pods('schema');
    if ($schemaPod) {
        KC::$schemaOrg = new SchemaOrg($schemaPod);
    }
}
コード例 #2
0
ファイル: header.php プロジェクト: kauaicreative/kc-child1
function draw_post_header($title = '', $excerpt = '', $bg = '', $size = 'full', $parallax = 'off')
{
    ////KC::debug(wp_get_attachment_image_src(get_post_thumbnail_id(1480), 'full'));
    $title = get_post_title($title);
    $excerpt = get_post_excerpt($excerpt);
    $bg = get_post_bg($bg, $size);
    $classes = "draw-post-header";
    if ($bg == KC::$default_header_image) {
        $classes .= " default-bg";
        $parallax = "off";
    }
    // possibly set these from custom post types
    //$parallax = "off"; // on/off
    $title = "<h2><span>{$title}</span></h2>";
    if ($excerpt) {
        $excerpt = "<h3><span>{$excerpt}</span></h3>";
    }
    KC::debug($excerpt);
    $content = <<<EOT
    [et_pb_section admin_label="section" background_image="{$bg}" transparent_background="on" allow_player_pause="off" inner_shadow="off" parallax="{$parallax}" parallax_method="true"
\t\tcustom_padding="" padding_mobile="on" make_fullwidth="off" use_custom_width="off" width_unit="on" make_equal="off" use_custom_gutter="off"]

\t[et_pb_row admin_label="row" make_fullwidth="off" use_custom_width="off" width_unit="off" custom_width_percent="" use_custom_gutter="off"
\t    padding_mobile="off" allow_player_pause="off" parallax="on" parallax_method="off" make_equal="off" column_padding_mobile="on"]

\t    [et_pb_column type="4_4"]

\t\t[et_pb_cta admin_label="Call To Action" title="" url_new_window="off" use_background_color="on" background_color="" background_layout="" text_orientation=""
\t\t\tcustom_margin="" custom_padding="" custom_button="off" button_letter_spacing="0" button_use_icon="default" button_icon_placement="right" button_on_hover="on" button_letter_spacing_hover="0"]
\t\t    {$title}
\t\t    {$excerpt}
\t\t[/et_pb_cta]
\t    [/et_pb_column]
\t[/et_pb_row]
    [/et_pb_section]
EOT;
    echo '<div class="' . $classes . '">' . do_shortcode($content) . '</div>';
}
コード例 #3
0
function get_post_bg($bg, $size)
{
    KC::debug('----');
    KC::debug($bg);
    KC::debug($size);
    KC::debug(get_attachment_image_url(false, $size));
    switch ($bg) {
        // get featured image from page/post
        case '':
            $bg = get_attachment_image_url(false, $size);
            break;
        case 'featured':
            $bg = get_attachment_image_url(false, $size);
            if (!$bg) {
                $bg = KC::$default_header_image;
            }
            break;
            // display featured image from blog's 1st post.
        // display featured image from blog's 1st post.
        case 'post1':
            $args = array('numberposts' => '1', 'order' => 'DESC', 'post_status' => 'publish');
            $recent_posts = wp_get_recent_posts($args);
            $recent_post = $recent_posts[0];
            $post_id = $recent_post["ID"];
            $thumb_id = get_post_thumbnail_id($post_id);
            $bg = get_attachment_image_url($thumb_id, $size);
            if (!$bg) {
                $bg = KC::$default_header_image;
            }
            break;
            // display the author's bio image
        // display the author's bio image
        case 'author':
            $bg = get_author_avatar_url();
            if (!$bg) {
                $bg = KC::$default_header_image;
            }
            break;
        case 'default':
            $bg = KC::$default_header_image;
            break;
    }
    //if (!$bg) $bg = KC::$default_header_image;
    return $bg;
}
コード例 #4
0
ファイル: SchemaOrg.php プロジェクト: kauaicreative/kc-child1
 function drawOpeningHours($str)
 {
     KC::debug($str);
     $lines = explode("\n", $str);
     $output = '';
     foreach ($lines as $line) {
         $output .= '<div class="openingHours"><meta itemprop="openingHours" content="' . $line . '">' . $this->formatHours($line) . '</div>';
     }
     return $output;
 }
コード例 #5
0
ファイル: functions.php プロジェクト: kauaicreative/kc-child1
/**
 * setup pods 
 */
function init_action()
{
    if (!function_exists('pods')) {
        return;
    }
    $settingsPod = pods('kc_settings');
    if ($settingsPod) {
        KC::$copyright = $settingsPod->field('copyright');
        KC::$author_slug = $settingsPod->field('authors_slug');
        KC::$default_header_image = PodUtils::getImgUrl($settingsPod, 'default_header_image', 'full');
    } else {
        KC::debug('no kc_settings pod');
    }
    $schemaPod = pods('schema');
    if ($schemaPod) {
        $data = new SchemaData();
        $data->url = get_site_url();
        $data->type = $schemaPod->field('type');
        // get_bloginfo();
        $data->name = $schemaPod->field('name');
        // get_bloginfo();
        $data->logo = PodUtils::getImgUrl($schemaPod, 'logo', 'full');
        //get_site_url() . "/wp-content/themes/kauaicreative.com/site-assets/logo.png";
        $data->streetAddress = $schemaPod->field('street_address');
        $data->addressLocality = $schemaPod->field('address_locality');
        $data->addressRegion = $schemaPod->field('address_region');
        $data->postalCode = $schemaPod->field('postal_code');
        $data->contactType = $schemaPod->field('contact_type');
        // customer service
        $data->telephone = $schemaPod->field('telephone');
        $data->email = $schemaPod->field('email');
        $data->hours = $schemaPod->field('hours');
        $schemaOrg = new SchemaOrg($data);
        KC::$schemaOrg = $schemaOrg;
    } else {
        KC::debug('no schema pod');
    }
    //if (!KC::$default_header_image) KC::$default_header_image	 = get_site_url() . "/wp-content/themes/kauaicreative.com/site-assets/default-bg.jpg";
    //KC::debug($data); // $schemaOrg->schemaData
}