Example #1
0
/**
 * show the published posts in the box of activitys
 */
function tiny_lposts($number)
{
    $number = (int) $number;
    $posts = get_posts('*', 'WHERE `status`= 1 ORDER BY `id` desc');
    if ($posts == null) {
        echo "<div class='no-content'><a href='edit-posts.php?action=add'>لا يوجد مقالات في موقعك يمكنك أن تنشئ واحد من هنا</a></div>";
    }
    $count = -1;
    if (!empty($posts)) {
        foreach ($posts as $post) {
            $count++;
            if ($count === $number) {
                break;
            }
            ?>
			<div class="tyni-draft">
				<a href="edit-posts.php?id=<?php 
            echo $post->id;
            ?>
"><?php 
            echo $post->title;
            ?>
</a> 
				<span class="small"><?php 
            echo mysql2date('Y-m-d', $post->date);
            ?>
</span>
				<p>
				 <?php 
            echo draft_excerpt_d($post->content);
            ?>
				</p>
			</div>
			<?php 
        }
    }
}
Example #2
0
function show_all_posts($extra = '')
{
    $posts = get_posts('*', ' ' . $extra . ' ORDER BY `id` desc');
    if ($posts == null) {
        echo "<tr><div class='no-content'><a href='edit-posts.php?action=add'>لا يوجد مقالات في موقعك يمكنك أن تنشئ واحد من هنا</a></div></tr>";
    }
    if (!empty($posts) && is_object($posts['0'])) {
        foreach ($posts as $post) {
            $author = @get_user_by_id($post->author);
            $thumbnail = get_post_meta($post->id, 'thumbnail');
            echo '<tr>
			<td>' . $post->id . '</td>
			<td>
				<a href="edit-posts.php?id=' . $post->id . '">
					<img class="post-thumb" src="' . $thumbnail . '" width="100" height="100" title="' . @$post->title . '" alt="' . @$post->title . '" />
				</a>

			</td>
			<td>
				<a href="edit-posts.php?id=' . $post->id . '">' . @$post->title . '</a> 
				<p>' . draft_excerpt_d(@$post->content) . '</p>
			</td>
			<td>' . @$author->display_name . '</td>
			<td>' . @mysql2date('Y-m-d', $post->date) . '</td>
			<td>empty</td>
			<td>غير مصنف</td>
		 </tr>';
        }
    }
    /*
    	foreach ($posts as $post) {
    		
    
    	}*/
}