WordPress function and its use

<?php bloginfo(‘name’); ?> – Title of the Blog, or Blog Name

<?php wp_title(); ?> – Title of a Specific Page

<?php bloginfo(‘url’); ?> – Exact URL for the Site

<?php bloginfo(‘description’); ?> – Site’s Description

<?php bloginfo(‘template_url’); ?> – Location of Site’s Theme File

<?php bloginfo(‘stylesheet_url’); ?> – Link to the Style.css location

<?php bloginfo(‘rss2_url’); ?> – RSS Feed URL for the Site

<?php bloginfo(‘pingback_url’); ?> – Pingback URL for the site

<?php bloginfo(‘version’); ?> – WordPress Version Number

<?php get_header(); ?> – Displays Header.php file content

<?php get_footer(); ?> – Displays Footer.php file content

<?php get_sidebar(); ?> – Displays Sidebar.php file content

<?php comments_template(); ?> – Displays Comment.php file content

<?php the_content(); ?> – Displays the Content of the Post

<?php the_excerpt(); ?> – Displays the excerpt that is used in Posts

<?php the_title(); ?> – Title of the Specific Post

<?php the_permalink() ?> – Link of the Specific Post

<?php the_category(‘, ‘) ?> – Category of a Specific Post

<?php the_author(); ?> – Author of the Specific Post

<?php the_ID(); ?> – ID of a Specific Post

<?php edit_post_link(); ?> – Edit link for a Post

<?php next_post_link(‘ %link ‘) ?> – URL of the Next Page

<?php previous_post_link(‘%link’) ?> – URL of the Previous Page

<?php get_links_list(); ?> – Lists all links in Blogroll

<?php wp_list_pages(); ?> – Lists all Pages

<?php wp_get_archives() ?> – List Archive for the Site

<?php wp_list_cats(); ?> – Lists all Categories

<?php get_calendar(); ?> – Displays the Built in Calendar

<?php wp_register(); ?> – Displays Register Link

<?php wp_loginout(); ?> – Displays Login/Logout Link only to Registered Users

Display Most popular Posts In WordPress

Add code in your theme where ever you want the popular 5 posts to be displayed.

    <?php $pc = new WP_Query('orderby=comment_count&posts_per_page=5'); 
      while ($pc->have_posts()) : $pc->the_post(); ?>
		<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
		<p>Posted by <strong><?php the_author() ?></strong> with <?php comments_popup_link('No Comments;', '1 Comment', '% Comments'); ?></p></li>
      <?php endwhile; ?>

How to add js and css in wordpress?

 * Proper way to enqueue scripts and styles
function theme_name_scripts() {
	wp_enqueue_style( 'style-name', get_stylesheet_uri() );
	wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );

add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );

Create Custom Post Type with Texamony(Categories) in WordPress

Custom Post types are very handy tool in wordpress. To create a custom Post Type is pretty easy.

Goto functions.php file of your theme folder and copy the below code. You will get the new section for adding posts. These can be used for many stuffs like creating a small plugin for News, FAQ’s etc.

Below is the code to be added in functions.php. I have added the comment wherever required.


Continue reading

Export the database table as CSV format using PHP

This code need some files those files are,
as in the db.php file, make this.

database name –> wallstreet
table name–> export_table
column names –> id,name,place
and as you, here i just declare what i have given in.

$conn = mysql_connect('localhost', 'root', '') or die(mysql_error());
$db=mysql_select_db('wallstreet', $conn) or die(mysql_error());



//header to give the order to the browser
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=exported-data.csv');

//select table to export the data
$select_table=mysql_query('select * from export_table');
$rows = mysql_fetch_assoc($select_table);

if ($rows)
$rows = mysql_fetch_assoc($select_table);

// get total number of fields present in the database
function getcsv($no_of_field_names)
$separate = '';

// do the action for all field names as field name
foreach ($no_of_field_names as $field_name)
if (preg_match('/\\r|\\n|,|"/', $field_name))
$field_name = '' . str_replace('', $field_name) . '';
echo $separate . $field_name;

//sepearte with the comma
$separate = ',';

//make new row and line
echo "\r\n";

this file is just for do the download, just give the link anchor tag,
usually you know to make just click export the data,
for that just give the link on anchor link, that will export the data table.

<a href="export.php"> export the database table </a>

Powerful WordPress Tips And Tricks

Piyush Pujara

I’ve been working with WordPress since the dawn of time, and even though I peek at the source code regularly, I still discover new tips and tricks. I’ve compiled my own list of 21 techniques that are handy, clever, fun or best practices rarely followed. I hope everyone finds something new in the list!

1. WordPress Has A Ton Of Built-In Scripts

Using the great wp_enqueue_script() and wp_enqueue_style(), you can include styles and scripts easily with dependency management. But did you know that WordPress has a lot of scripts already built in? jQuery, many elements of jQuery UI, jQuery Form, SWF Object, Tiny MCE, Jcrop and Thickbox are just some the better known ones. The whole list can be found in the WordPress Codex. If you’re interested in learning how to use the enqueue functions effectively, I recommend .The Developer’s Guide to Conflict-Free JavaScript and CSS in WordPress right…

View original post 287 more words

Drag and drop using jquery


Create .html file

<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
<script type="text/javascript">
 // Example 1.1: A single sortable list
 $('#example-1-1 .sortable-list').sortable();
 // Example 1.2: Sortable and connectable lists
 $('#example-1-2 .sortable-list').sortable({
 connectWith: '#example-1-2 .sortable-list'
 // Example 1.3: Sortable and connectable lists with visual helper
 $('#example-1-3 .sortable-list').sortable({
 connectWith: '#example-1-3 .sortable-list',
 placeholder: 'placeholder',
 // Example 1.4: Sortable and connectable lists (within containment)
 $('#example-1-4 .sortable-list').sortable({
 connectWith: '#example-1-4 .sortable-list',
 containment: '#containment'
 Continue reading