11 Jul 2014

Php Open-source Click 001


>Moodle - Open-source learning platform
A free, open-source PHP web application for producing modular internet-based courses that support a modern social constructionist pedagogy.

https://moodle.org



>Osclass
Osclass is an open source project that allows you to easily create a classifieds website.

Get your own classified website with Osclass for free. Build your own Osclass installation and start advertising real estate, jobs or whatever you want- in minutes!

http://osclass.org

3 Jul 2014

How to show all categories and posts in wordpress page?

Create new wordpress template and past the following code

<?php
/**
 * Template Name: all categories and posts Template
 * Description: Show all categories and posts Template.
 *
 *
*/
?>

<?php get_header(); ?>

<?php
//get all categories then display all posts in each term
$taxonomy = 'category';
$param_type = 'category__in';
$term_args=array(
  'orderby' => 'name',
  'order' => 'ASC'
);
$terms = get_terms($taxonomy,$term_args);
if ($terms) {
  foreach( $terms as $term ) {
    $args=array(
      "$param_type" => array($term->term_id),
      'post_type' => 'post',
      'post_status' => 'publish',
     // 'posts_per_page' => -1,
      'caller_get_posts'=> 1
      );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {  ?>
      <div class="category section">
        <h3><?php echo $term->name;?></h3>
        <ul>
        <?php
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
       <?php
      endwhile;
      ?>
      </ul>
      </div>
 <?php
    }
  }
}
wp_reset_query();  // Restore global post data stomped by the_post().
?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>