function theme_get_widget_style($id, $style = null) { if (theme_is_vmenu_widget($id)) { return 'vmenu'; } $result = theme_get_meta_option($id, 'theme_widget_styles'); global $theme_widgets_style; if (!in_array($result, array_keys($theme_widgets_style))) { $result = 'default'; } if ($style != null) { if (!in_array($style, array('block', 'post', 'simple'))) { $style = 'block'; } if ($result == 'default') { $result = $style; } } return $result; }
<?php /** * * content*.php * * The post format template. You can change the structure of your posts or add/remove post elements here. * * 'id' - post id * 'class' - post class * 'thumbnail' - post icon * 'title' - post title * 'before' - post header metadata * 'content' - post content * 'after' - post footer metadata * * To create a new custom post format template you must create a file "content-YourTemplateName.php" * Then copy the contents of the existing content.php into your file and edit it the way you want. * * Change an existing get_template_part() function as follows: * get_template_part('content', 'YourTemplateName'); * */ global $post; theme_post_wrapper(array('id' => theme_get_post_id(), 'class' => theme_get_post_class(), 'title' => theme_get_meta_option($post->ID, 'theme_show_page_title') ? get_the_title() : '', 'heading' => theme_get_option('theme_single_article_title_tag'), 'before' => theme_get_metadata_icons('edit', 'header'), 'content' => theme_get_content())); ?>
function theme_init_layout() { global $theme_layout; $theme_layout = array('header' => 1, 'left_sidebar' => 1); if (is_page()) { foreach ($theme_layout as $layout_part_name => $included) { $theme_layout[$layout_part_name] = theme_get_meta_option(theme_get_the_ID(), 'theme_layout_template_' . $layout_part_name); } } elseif (is_attachment()) { $theme_layout['left_sidebar'] = 0; } }
<?php /** * * content*.php * * The post format template. You can change the structure of your posts or add/remove post elements here. * * 'id' - post id * 'class' - post class * 'thumbnail' - post icon * 'title' - post title * 'before' - post header metadata * 'content' - post content * 'after' - post footer metadata * * To create a new custom post format template you must create a file "content-YourTemplateName.php" * Then copy the contents of the existing content.php into your file and edit it the way you want. * * Change an existing get_template_part() function as follows: * get_template_part('content', 'YourTemplateName'); * */ global $post; theme_post_wrapper(array('id' => theme_get_post_id(), 'class' => theme_get_post_class(), 'title' => theme_get_meta_option($post->ID, 'theme_show_post_title') ? get_the_title() : '', 'heading' => theme_get_option('theme_single_article_title_tag'), 'before' => theme_get_metadata_icons('date,author,edit', 'header'), 'content' => theme_get_content(), 'after' => theme_get_metadata_icons('category,tag', 'footer')));
<?php /** * * content*.php * * The post format template. You can change the structure of your posts or add/remove post elements here. * * 'id' - post id * 'class' - post class * 'thumbnail' - post icon * 'title' - post title * 'before' - post header metadata * 'content' - post content * 'after' - post footer metadata * * To create a new custom post format template you must create a file "content-YourTemplateName.php" * Then copy the contents of the existing content.php into your file and edit it the way you want. * * Change an existing get_template_part() function as follows: * get_template_part('content', 'YourTemplateName'); * */ global $post; theme_post_wrapper(array('id' => theme_get_post_id(), 'class' => theme_get_post_class(), 'title' => theme_get_meta_option($post->ID, 'theme_show_post_title') ? '<a href="' . get_permalink($post->ID) . '" rel="bookmark" title="' . strip_tags(get_the_title()) . '">' . get_the_title() . '</a>' : '', 'heading' => theme_get_option('theme_posts_article_title_tag'), 'before' => theme_get_metadata_icons('date,author,edit', 'header'), 'content' => theme_highlight_excerpt(get_search_query(), theme_get_content()), 'after' => theme_get_metadata_icons('category,tag', 'footer')));
function theme_print_page_header_image_meta_box($post) { $theme_header_image = theme_get_meta_option($post->ID, 'theme_header_image'); $theme_header_image_with_flash = theme_get_meta_option($post->ID, 'theme_header_image_with_flash') ? 'checked="checked" ' : ''; ?> <input id="upload_image_input" type="hidden" size="20" tabindex="6" name="theme_header_image" value="<?php echo $theme_header_image; ?> " autocomplete="off" /> <p class="hide-if-no-js image_control"> <a href="#" class="upload_image"> <img id="upload_image_image" src="<?php echo $theme_header_image; ?> " width="260" alt="Header Image" /> </a> <br> <a href="#" id="remove_image_button"><?php echo __("Remove header image", THEME_NS); ?> </a> </p> <p class="hide-if-no-js"> <a href="#" class="upload_image" id="upload_image_button" ><?php echo __("Set header image", THEME_NS); ?> </a> </p> <style> </style> <script> if(jQuery("#upload_image_input").val() == ""){ jQuery('.image_control').hide(); } else { jQuery("#upload_image_button").hide(); } jQuery(document).ready(function($) { jQuery(".upload_image").click(function() { window.send_to_editor_default = window.send_to_editor; window.send_to_editor = function(html) { imgurl = jQuery("img", html).attr("src"); jQuery("#upload_image_image").attr("src", imgurl); jQuery("#upload_image_input").val(imgurl); jQuery("#upload_image_button").hide(); jQuery('.image_control').show(); tb_remove(); }; tb_show("", "media-upload.php?type=image_header&post_id=<?php echo $post->ID; ?> &TB_iframe=true"); return false; }); jQuery("#remove_image_button").click(function() { jQuery("#upload_image_image").attr("src", ""); jQuery("#upload_image_input").val(""); jQuery('.image_control').hide(); jQuery("#upload_image_button").show(); return false; }); jQuery("#TB_window").live("tb_unload", function(){ if (window.send_to_editor_default) window.send_to_editor = window.send_to_editor_default; }); }); </script> <?php }
function theme_get_pages($pages) { if (is_admin()) { return $pages; } $excluded_ids = array(); foreach ($pages as $page) { if (!theme_get_meta_option($page->ID, 'theme_show_in_menu')) { $excluded_ids[] = $page->ID; } } $excluded_parent_ids = array(); foreach ($pages as $page) { $title = theme_get_meta_option($page->ID, 'theme_title_in_menu'); if ($title) { $page->post_title = $title; } if (in_array($page->ID, $excluded_ids)) { $excluded_parent_ids[$page->ID] = $page->post_parent; } } $length = count($pages); for ($i = 0; $i < $length; $i++) { $page =& $pages[$i]; if (in_array($page->post_parent, $excluded_ids)) { $page->post_parent = theme_get_array_value($excluded_parent_ids, $page->post_parent, $page->post_parent); } if (in_array($page->ID, $excluded_ids)) { unset($pages[$i]); } } if (!is_array($pages)) { $pages = (array) $pages; } $pages = array_values($pages); return $pages; }
function theme_init_layout() { global $theme_layout; $theme_layout = array('header' => 1, 'default_sidebar' => 1); $page_id = 0; if (is_page()) { $page_id = (int) theme_get_the_ID(); } if (is_home()) { $posts_page_id = (int) get_option('page_for_posts'); if ($posts_page_id > 0) { $page_id = $posts_page_id; } } if ($page_id > 0) { foreach ($theme_layout as $layout_part_name => $included) { $theme_layout[$layout_part_name] = theme_get_meta_option($page_id, 'theme_layout_template_' . $layout_part_name); } } if (is_attachment()) { $theme_layout['default_sidebar'] = 0; } }
function theme_print_meta_box($post, $meta_options) { // Use nonce for verification wp_nonce_field('theme_meta_options', 'theme_meta_noncename'); if (!isset($post)) { return; } foreach ($meta_options as $option) { $id = theme_get_array_value($option, 'id'); $name = theme_get_array_value($option, 'name'); $desc = theme_get_array_value($option, 'desc'); $value = theme_get_meta_option($post->ID, $id); $necessary = theme_get_array_value($option, 'necessary'); if ($necessary && !current_user_can($necessary)) { continue; } echo '<p class="meta-options"><label class="selectit" for="' . $id . '"><strong>' . $name . '</strong></label><br />'; theme_print_option_control($option, $value); if ($desc) { echo '<em>' . $desc . '</em>'; } echo '</p>'; } }
function theme_get_content($args = array()) { global $wp_query; $post_id = get_queried_object_id(); $more_tag = theme_get_array_value($args, 'more_tag', __('Continue reading <span class="meta-nav">→</span>', THEME_NS)); $ignore_wpautop = theme_get_meta_option($post_id, 'theme_use_wpautop') === '0'; if ($ignore_wpautop) { remove_filter('the_content', 'wpautop'); } theme_ob_start(); the_content($more_tag); $content = theme_ob_get_clean(); if ($ignore_wpautop) { add_filter('the_content', 'wpautop'); } return $content . wp_link_pages(array('before' => '<p><span class="page-navi-outer page-navi-caption"><span class="page-navi-inner">' . __('Pages', THEME_NS) . ': </span></span>', 'after' => '</p>', 'link_before' => '<span class="page-navi-outer"><span class="page-navi-inner">', 'link_after' => '</span></span>', 'echo' => 0)); }
<?php global $post; theme_post_wrapper(array('id' => theme_get_post_id(), 'class' => theme_get_post_class(), 'title' => theme_get_meta_option($post->ID, 'theme_show_post_title') ? get_the_title() : '', 'content' => theme_get_content()));