Search This Blog

Monday, August 20, 2012

Display Post by its category in wordpress

<ul>
<?php
global $post;
$args = array( 'numberposts' => 1000, 'offset'=> 0, 'category_name'=> 'Blog Posts' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :    setup_postdata($post); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>

For more information checkout our official website.

Friday, August 17, 2012

Session Start & Close in PHP

Put this code on all the pages in admin for start a session....

<?php

session_start();
if(!isset($_SESSION['login_user'])){
    header("Location:../admin/index.php");
}

?>

use this code to unset or destroy the session..

unset($_SESSION['login_user']);

For more information checkout our official website.