Пример #1
0
    $tags_list = get_the_tag_list('', __(', ', 'Momofuku'));
    if ($tags_list) {
        ?>
			<span class="tag-links">
				<?php 
        printf(__('Tagged %1$s', 'Momofuku'), $tags_list);
        ?>
			</span>
			<?php 
    }
    // End if $tags_list
    ?>
		<?php 
}
// End if 'post' == get_post_type()
?>
    <span class="comments-number"><?php 
momo_comments_number();
?>
</span>
    <?php 
echo get_post_comments($post->ID, 3);
momo_comments_form();
?>

	</footer><!-- #entry-meta -->
</article><!-- #post-<?php 
the_ID();
?>
 -->
Пример #2
0
<?php

require 'init.php';
$post_id = $_GET['id'];
$post = get_post_by_id($post_id);
if (!$post) {
    display_not_found_page();
}
$comments = get_post_comments($post_id);
$comment_text = '';
$errors = [];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $comment_text = $_POST['comment'];
    if ($comment_text == '') {
        $errors[] = "Коментар не може бути порожнім.";
    }
    if (!$errors) {
        $user_id = get_current_user_id();
        add_comment($post_id, $user_id, $comment_text);
        redirect(APP_URL . '/view_post.php?id=' . $post_id);
    }
}
?>

<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>Tubogram</title>
    <?php 
echo js_and_css();
?>
	<header class="entry-header">
		<h1 class="entry-title">
        <?php 
the_title();
?>
        <?php 
edit_post_link('');
?>
    </h1>
	</header><!-- .entry-header -->

	<div class="entry-content">
		<?php 
the_content();
?>
		<?php 
wp_link_pages(array('before' => '<div class="page-link">' . __('Pages:', 'Momofuku'), 'after' => '</div>'));
?>
	</div><!-- .entry-content -->
  <?php 
// Spit out all comments (get all when you pass null instead of a number
// AND dump the commenting form.
echo get_post_comments($post->ID, null);
momo_comments_form();
?>

</article><!-- #post-<?php 
the_ID();
?>
 -->
Пример #4
0
    } else {
        log_write('Не удалось удалить запись: не достаточно прав', '0', '1');
        print_error('Не достаточно прав для выполнения действия');
    }
}
// Вывод списка записей
if ($_GET['action'] == 'list' && empty($error)) {
    $limit = "10";
    $category_title = get_categories_title();
    $post_list = get_posts($limit);
    $tpl = "posts_list_tpl.php";
}
// Просмотр записи
if ($_GET['action'] == 'view' && empty($error)) {
    $post_view = get_post($_GET['id']);
    $comments_view = get_post_comments($_GET['id']);
    $tpl = "posts_view_tpl.php";
}
// Добавление новой или изменение существующей записи
if ($_GET['action'] == 'add' || $_GET['action'] == 'edit') {
    if ($_GET['action'] == 'edit' && isset($_GET['id'])) {
        $post_edit = get_post($_GET['id']);
        $subcategory_list = get_subcategories($post_edit['type']);
    }
    $category_list = get_categories();
    $tpl = "posts_add_tpl.php";
}
// форма добавления и редактирования раздела
if ($_GET['id'] && $_GET['action'] == 'edit_category' || $_GET['action'] == 'add_category') {
    $category_edit = get_category($_GET['id']);
    $tpl = "posts_edit_category_tpl.php";