Glow an open source javascript library by BBC


 

 

 

 

 

 

Open Source a big bang which is spreading like a fire in the forest. Everything today has an open-source alternative, let it be Microsoft Windows, Photoshop, Microsoft Office, Outlook Express or whatever. The best thing about Open Source is that people actually love it and the community contributes

number of post show


that code is used
<?php $posts = query_posts( $query_string . ‘&orderby=title&order=asc’ ); ?>
<?php if( $posts ) : ?>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php endif; ?></ul>

Add default content for a new post in WordPress


o what if we can automate that type of text such that it shows up automatically whenever you start writing a new post ? Yes, that will be something awesome, hence in this blog post I am going to show you how you can do that in your blog. I am sure there must be some plugins out already for this trick, but my aim here is to make you understand how simple it is to do your own thing icon smile Add default content for a new post in WordPress

Since you know WordPress comes with lot of hooks and filters to make the development process easier. Hence we are going to use a filter which will allow us to populate some pre-defined text while creating a new post. Now let us see how to go about it.

Open functions.php which is present in the themes folder of your blog and copy the following code at the end of the file.

 
/**
 * Add a filter called default_content
 */
add_filter('default_content', 'add_pre_populated_content');

/**
 * function will get called by the filter defined above
 */
function add_pre_populated_content( $content ) {
        // you can change the content as per your requirement
	$content = "<p>Stay Digified!!<br/>Sachin Khosla</p>";
	return $content;
}

As you can see the we have added a filter called “default_content” in WordPress which is used when you hit “Add New Post” in your WordPress Admin dashboard. You can put as much content as you want to add as per your requirement. I told you already that it’s simple, right ? So go ahead and add this code snippet in your blog and enjoy.

Enable Apache,PHP in Mac OS X


Mac OS X comes with Apache,PHP pre-installed but is not enabled by default. Just when you get on to your new Mac OS X you definitely want to enable these. The following steps should help you enable PHP over Apache and you can start rolling. Enable PHP module in httpd.conf   * We first need to enable PHP module in Apache’s configuration file i.e. httpd.conf. This configuration file,httpd.conf, is stored in /etc/apache2 folder which is hidden by default. * You can directly jump into this folder by clicking on Go > Go To Folder and type /etc/apache2 . * From this folder open httpd.conf  in your favorite text editor. I am using Text Wrangler for this example. * Since this file requires root permission to edit, you can unlock this before editing. text wrangler file unlock Enable Apache,PHP in Mac OS XAlternatively, if you are not using TextWrangler, then you can open this file in OS X’s default editor called Text Edit, using this  command, sudo open -t /etc/apache2/httpd.conf * In the config file, search for the line which says “#LoadModule php5_module libexec/apache2/libphp5.so” . Notice, that it has a hash sign (#)  at the start, this means that it is commented. Just uncomment this line, by removing the hash sign (#) from the start and save the file. For my httpd.conf  the line no. is 111, you can search for string “php5” to quickly search this line. * With this step we have enabled the PHP5 module on Apache server. Creating the default php.ini Next we need to create a default php.ini file for PHP to run successfully. A default php.ini exists in the /etc  folder with the name php.ini.default . You first need to duplicate this file and simply save it with the name php.ini . If you are an advanced user or need to make any changes to the default php configuration, you can do it now or later in this very file.