Front End Posting with WordPress

In this tutorial I am going to discuss how to insert posts via the front end of a WordPress blog. This tutorial will also cover some validation techniques, setting the post as “pending”, and email notification when a new post is created. So let’s begin!

First, you would want to create a new page, let’s call it “Add Article” with a slug of “add-article”. Make sure that your permalink settings it set to “/%postname%/”

Create a PHP file: page-add-article.php. Test this page, it should show a blank white screen.
Continue Reading…

How to create a custom query using shortcode

Have you ever tried to create a shortcode which create a custom worpress query?

Try with below code, i suggest the below code if you wish to show any articles/post to anywhere in the site using this shortcode.

You can get content using wordpress shortcode by passing your queries.

if(!function_exists ('custom_query')){
	function custom_query($atts)
		$result = '';
		global $post;
		$query = new wp_query($query_string);
		if($query->have_posts()) {
			while($query->have_posts()) { $query->the_post();
				$result.="<div class='post-item'>
<a href=".get_permalink()."><img width='100' height='100' src=".$meta." /></a>
<h1><a href=".get_permalink().">".get_the_title()."</a></h1>
<p class='metadata'><span class='post'>Posted by:</span>".get_the_author()."<span class='in-cat'>In:</span>".get_the_category_list(', ')."<span class='on-date'>On:</span>".get_comment_time()."<a href=".get_comments_link().">".get_comments_number('1 comment','2 comment','% comment')."</a></p>
<p>".get_the_content()."</p><p><a class='more-link floatright' href=".get_permalink().">Read More</a></p></div>";
		return $result;

You can use the shortcode [custom_query]

Example: [custom_query query_string=’cat=4′].

This will help you to create custom query using shortcode.

How To Make WordPress Theme Multilingual and WooCommerce Compatible

In this article you can learn about how to create a wordpress theme which is perfectly suitable for Woocommerce and WPML.

Before starting i would like to mention some points.

In order to have a multilingual woocommerce website you need to install the following plugins.

Woocommerce By Woothemes –

WPML By OnTheGoSystems,Inc. – (

Woocommerce Multilingual – (

WPML allows you to translate all the standard WordPress elements. This includes:

  • Menus
  • Standard widgets
  • Navigation elements
  • All texts wrapped in `gettext` calls
  • Post content including custom fields and taxonomy
  • Products
  • Theme options
  • Images and strings related to them

In order to have a WPML supported theme, you must follow the below conditions.

Add GetText Functions to Texts

For plugins or themes, be sure to wrap your hard-coded text in `gettext` functions. This includes the header, footer, and widget text. Your template files display an assortment of product information and hard coded text. For example, most templates will include the product name and a ‘buy’ link. The product name comes from the database, so you don’t need to worry about translating it.
Continue Reading…

How to install Joomla on Ubuntu 14.04

Joomla is one of the most popular free content management systems (CMS) in the world that allows you to easily create and manage a dynamic website. This articles is a simple guide on how to install joomla in Ubuntu 14.04 (a well establshed operating system since 2004.).

First of all we should create a database for joomla, Go to MySQL shell first

mysql -u root -p

Create a database using the following command. I just named my database ‘mydatabase’. You can give a name of youe choice.

CREATE USER joomlauser@localhost;
SET PASSWORD FOR joomlauser@localhost= PASSWORD("mypassword");

Giving privileges to the user on Mysql-server.

GRANT ALL PRIVILEGES ON mydatabase.* TO joomlauser@localhost IDENTIFIED BY 'mypassword';

Refresh MySQL:


Exit out of the MySQL shell:


Restart apache and mysql:

service apache2 restart
service mysql restart

We will first make a directory temp, where we can download and temporarily store our Joomla files:
create a directory

mkdir temp

change directory to temp

cd temp

Now we are in the temp directory. We will then download the latest version of joomla(it is joomla 3.3.3 at the time of writing) to this directory.


We need to install unzip as by default it is now installed:

apt-get install unzip

Now create a directory for keep our joomla files( I named it ‘joomla’) in/var/www/html/

mkdir -p /var/www/html/joomla

unzip the Joomla zip file in the newly created folder:

unzip -q -d /var/www/html/joomla

Now give appropriate permissions in the directory

chown -R www-data.www-data /var/www/html/joomla
chmod -R 755 /var/www/html/joomla

Now proceed to the web installation of Joomla.
You can now complete the remaining steps in your browser. Go to the URL http://domain name orIP address/joomla:

Follow the installation steps.

Once you have finished going through the installer, delete the installation folder per Joomla’s instructions and change the permissions on the config file:

sudo rm -rf /var/www/installation/
sudo chmod 755 /var/www/configuration.php

Now you can access the admin panel at http://domain name orIP address/joomla/administrator/ give the credentials as you gave at the time of Joomla installation.

WordPress Recent Users

Yesterday i came up in a situation to show the recently registered users in one of my ongoing projects. I have made this requirement by using below code.

This code can be placed in your function.php of theme.

function recently_registered_users() {
global $wpdb;
$recentusers = '<ul>';
$usernames = $wpdb->get_results("SELECT user_nicename, user_url, user_email FROM $wpdb->users ORDER BY ID DESC LIMIT 5");
foreach ($usernames as $username) {
if (!$username->user_url) :
$recentusers .= '<li>' .get_avatar($username->user_email, 45) .$username->user_nicename."</a></li>";
else :
$recentusers .= '<li>' .get_avatar($username->user_email, 45).'<a href="'.$username->user_url.'">'.$username->user_nicename."</a></li>";
$recentusers .= '</ul>';
return $recentusers;

After that we need to use the below code for displaying it wherever you required. I have placed the code in my sidebar

<?php recently_registered_users(); ?>

If you wish to have a shortcode for this, it can be simply added by using the below code to the functions.php

add_shortcode('recentusers', 'recently_registered_users');

By adding this shortcode you can use the functionlaty where ever you need. Like in post, pages etc.

You may need to use the bellow shortcode for display the newly registered users in post, pages or widget.


By adding this you can show your recently registered WordPress users in your sidebar or post or pages.

Hope this help some one…..!!!!!

WP Security Audit Log

Its very important to ensure the security of your wordpress site, You have to take some basic security precautions for your site.WP Security Audit log will Identify WordPress security issues before they become a security problem. It Keeps  a security audit log of what is happening under the hood of your WordPress blog or website or your WordPress Multisite installation.

This plugin will work both on WordPress single site installations and WordPress Multisite.

 Audit Log plugin is developed by WordPress Security Consultants and Professionals WP White Security and is the only WordPress monitoring and auditing plugin that works on both WordPress single site installations and WordPress Multisite.

Download From:

Woocommerce – add products automatically to cart on visit

Today i am going to share one of the feature which my client asked to me, and that is to add the product automatically once the visitor viewed that product. Hope this will help someone who is having requirement like this.

* To be added on theme's functions.php or a custom plugin
// add products automatically to cart on visit
add_action( 'init', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
global $woocommerce;
$product_id = 64;
$found = false;
//check if product already in cart
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
if ( $_product->id == $product_id )
$found = true;
// if product not found, add it
if ( ! $found )
$woocommerce->cart->add_to_cart( $product_id );
} else {
// if no products in cart, add it
$woocommerce->cart->add_to_cart( $product_id );