Add custom menu, Add theme locations & register new menu

Wordpress developers guide to add custom menu in a new wordpress theme. Adding theme locations, menu locations, register new menu, menu locations and integrate menu in templates using register_nav_menu & wp_nav_menu functions.

A WordPress developers guide / tutorial – for adding custom menu in new wordpress theme, add one or multiple new theme locations for the custom WordPress menus, so that menu can appear in those places. Register new menu items. Enable your new wordpress theme to add custom user defined nav menus from the admin dashboard. Continue reading “Add custom menu, Add theme locations & register new menu”

Password protecting WordPress Page / Post in which you need to enter password every time

Special type of password protection of Wordpress Pages or Posts in which you need to enter password every time. Normally you need to enter password only once.

Password protecting WordPress Page or Post : in which you need to enter password every time.

The Problem is : I have set a password for a  page/post in my wordpress blog. I need to ensure that the information should be protected by a password. Normally if you enter a password its kept by the browser cookies. So you don’t need to re-enter passwords. But if I don’t want that. Then what- if I need to re-enter password for each visit..???? Continue reading “Password protecting WordPress Page / Post in which you need to enter password every time”

No plugin required- remove the pending spam comments in wordpress

Are you in trouble by 1000s of spam comments of WordPress? Everyday you are getting hundreds of spam comments and you are deleting them via WordPress dashboard -> comments link manually?

Do you know without a plugin you can do this and just you need to write SQL command for it. And you need your website database access for it. Use this SQL command

select * from wp_comments where comment_approved = “0″; Continue reading “No plugin required- remove the pending spam comments in wordpress”

How to create wordpress plugins: tutorials

WP Plugin Creation – Create a Custom WordPress Plugin From Scratch. Create feedback form plugins. Create plugins that access databases and wordpress admin section.

I have found the following WordPress tutorials very useful for the beginners to write a plugin in WordPress. Here few plugins tutorial has been listed below. You will be able to build simple contact forms in WordPress after reading one, another tutorial will guide you to change the administration section and login page logo etc. Just go through them and enjoy… Continue reading “How to create wordpress plugins: tutorials”

WebRoot access permission, Cannot write in /www/var/html

To install WordPress, to update WP themes in ubuntu, to install or update plugins (WP), to install new WP themes in the WEBROOT of local web servers like Apache, you may have faced the following type of access problems & permission errors.

To install WordPress, to update WP themes in ubuntu, to install or update plugins (WP), to install new WP themes in the WEBROOT of local web servers like Apache, you may have faced the following type of problems. Normally web server folder in local Ubuntu installations are located in /var/www/html . Continue reading “WebRoot access permission, Cannot write in /www/var/html”

PHP Syntax- heredoc, string, variables and constants, logical operators

PHP Tutorial- Chapter 1 (PHP Syntax)

How to use HEREDOC in PHP with examples, also use easy to use examples in PHP for declaring variables, constants. Also know which tags you can use in PHP script to write PHP code in it. Continue reading “PHP Syntax- heredoc, string, variables and constants, logical operators”

The steps to connect MySQL database with PHP

The steps to connect MySQL database with PHP with simple PHP code example.

The steps to connect MySQL database with PHP with simple PHP code example.

  1. Connect the server
  2. Select the DB
  3. Write theSQL query
  4. Execute the query & get the resultset / query output in a variable $result.
  5. If resultset contains greater than 1 record the process each record of the recordset by a while loop

<?php

$MYSQL_HOST = “localhost”;
$MYSQL_USER = “bikram”;
$MYSQL_PASS = “bikram”;

$MYSQL_DB_NAME = “eworkshop”;

// connect the server
$server = mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASS) or die(“MySQL server connection error : “.mysql_error());
echo “server connected<br />”;

//connect the DB
mysql_select_db( $MYSQL_DB_NAME , $server) or die(“”.mysql_error());
echo “db connected<br />”;

// execute query
$query = “select vehicle_name from vehicle_table“;
$result = mysql_query($query) or die( mysql_error());

if(mysql_num_rows($result) > 0)
{
echo “<table><tr><th>vehicle name</th></tr>”;

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo “<tr><td>”.$row[“vehicle_name”].”</td></tr>”;
}
echo “</table>”;
}
?>

Static Variables in PHP with simple example

Static Variables in PHP with simple example. It retains the local variable value and it donot loose its value at the end of function call.

Static in PHP:

Retains the local variable value and it donot loose its value at the end of function call.

<?php
function f()
{
static $x=1;
echo $x.”<br />”;
$x++;
}
f();
f();
?>

Output  of this program:

1
2

WordPress problem in localhost- .htaccess causing internal server error 500

When you try to install wordpress in Localhost using WAMP server in Windows many of us faced .htaccess file in wordpress root folder causing internal server error 500 and wordpress don’t run properly.

.htaccess in WAMP Server (in WordPress local installation) showing internal server error 500, how to solve it?

The solution is :

  • Left Mouse Click on Wampserver icon in the System Tray in Windows7/XP etc and
  • Goto Apache -> httpd.conf
  • a file will open and in it
  • and search “#LoadModule rewrite_module modules/mod_rewrite.so”.
  • Remove the # as below and save it as follows
  • LoadModule rewrite_module modules/mod_rewrite.so
  • then restart all service.

Actually you need to enable the mod_rewrite module in Apache server. In the httpd.conf file, the configuration file of Apache, find “LoadModule rewrite_module modules/mod_rewrite.so” and remove the pound (#) symbol from the beginning of this line and then save the file and restart WAMP by left mouse click- restart all services.

Also in some cases you need to change AllowOverride none in the httpd.conf to AllowOverride all as well. Read it in wordpress forum

Reference Reading :Some more information on Apache HTACCESS internal server error 500 in Wamp or wordpress installation in wamp server visit this page