What’s New in WordPress 4.0 “Benny”

Version 4.0 of WordPress, named “Benny” in honor of jazz clarinetist and bandleader Benny Goodman.

  • Manage your media with style
  • Working with embeds has never been easier
  • Focus on your content
  • Finding the right plugin

Please check the blow video by kimmimebaby

“What’s New in WordPress 4.0 “Benny” – 11 New Features Found”

Please find more details https://wordpress.org/news/2014/09/benny/

How to Disable WordPress Admin Bar for All Users Except Administrators

I am working on new public domain website http://www.forefingerfirst.com/ where people can only able to vote after FB login. So i have done customized the easy facebook login plugin.

But then we are facing the issue that once user login with FB. He/She was getting Admin bar. So i have search for solution and below is step for same.

Just open function.php from our current theme and add below code

add_action('after_setup_theme', 'remove_admin_bar');

function remove_admin_bar() {
if (!current_user_can(‘administrator’) && !is_admin()) {
show_admin_bar(false);
}
}

Disable Admin Bar for All Users

If you want to disable it for all users, then simply put use this code in your theme’s functions.php file


/* Disable WordPress Admin Bar for all users but admins. */
show_admin_bar(false);

How to make your WordPress Website Secure

You have find many discussion about WordPress is not secure or easy to hack. I will share some of plugin which can make your website more secure.

Google Authenticator

The Google Authenticator plugin for WordPress gives you two-factor authentication using the Google Authenticator app for Android/iPhone/Blackberry.

Download here

Limit Login Attempts

Limit the number of login attempts possible both through normal login as well as using auth cookies.

Download here

BackWPup Free – WordPress Backup Plugin

Schedule complete automatic backups of your WordPress installation. Decide which content will be stored (Dropbox, S3…). This is the free version

Download here

Disclaimer: You have to check plugin details before your installing that its has to be compatible with your website version

How to increase font size based on window width by using jQuery and CSS

HI

Add below CSS

<style type=”text/css”>

body {font-size:62.5%;} /* Set the size of 1em to 10px in all browsers */

body.extraWide {font-size:85%;}
body.wide {font-size:75%;}

body.narrow {font-size:50%;}
body.extraNarrow {font-size:40%;}

</style>

and add jQuery with the support of  a set timeout so it would scale in real time. It doesn’t reverse scale though.

$(document).ready(function() {scaleFont();});

function scaleFont() {

var viewPortWidth = $(window).width();

if (viewPortWidth >= 1900) {$(‘body’).addClass(‘extraWide’).removeClass(‘wide, standard, narrow, extraNarrow’)}
else if (viewPortWidth >= 1400) {$(‘body’).addClass(‘wide’).removeClass(‘extraWide, standard, narrow, extraNarrow’)}
else if (viewPortWidth >= 1000) {$(‘body’).addClass(‘standard’).removeClass(‘extraWide, wide, narrow, extraNarrow’)}
else if (viewPortWidth >= 700) {$(‘body’).addClass(‘narrow’).removeClass(‘extraWide, standard, wide, extraNarrow’)}
else {$(‘body’).addClass(‘extraNarrow’).removeClass(‘extraWide, standard, wide, narrow’)}

setTimeout(scaleFont, 100);

}

or you can use it re sizes only if window is resized (avoiding setTimout), and you give body only the exact class it needs

$(document).ready(function() {

scaleFont();

});
$(window).resize(function() {

scaleFont();

});


function scaleFont() {

var viewPortWidth = $(window).width();

if (viewPortWidth >= 1900) {$(‘body’).attr(‘class’,’extraWide’);}
else if (viewPortWidth >= 1400) {$(‘body’).attr(‘class’,’wide’);}
else if (viewPortWidth >= 1000) {$(‘body’).attr(‘class’,”);}
else if (viewPortWidth >= 700) {$(‘body’).attr(‘class’,’narrow’);}
else {$(‘body’).attr(‘class’,’extraNarrow’);}

}

 

Sources: http://stackoverflow.com/questions/3146395/how-to-increase-font-size-based-on-window-width

Apache web server: Mapping a URL to a local directory in Ubuntu

We would like to serve the content of a local directory to the Web through the Apache web server. The problem is that the directory isn’t into the Apache document root and we do not want to move it there. :-/

To solve this we will map a URL starting with /desired_URL to files in the /path/to/directory/ directory.

Edit the /etc/apache/sites-enabled/site-configuration-file (this file should be a symbolic link to the corresponding file in /etc/apache/sites-available/).

Add an alias of the local directory to the desired URL, e.g. map the http://www.example.com/desired_URL to the /path/to/directory/ directory.

Alias "/desired_URL/" "/path/to/directory/"

Afterwards add the following instructions for the directory:

        <Directory "/path/to/directory/">
                Options +Indexes +FollowSymLinks
                Order allow,deny
                Allow from all
        </Directory>

This will enable access to the specified directory and its symbolic links, and produce an html page with the file list of the directory. Please ensure that all directories of the /path/to/directory/ has the required execute permissions.

Sources: http://cilab.math.upatras.gr/mikeagn/content/apache-web-server-mapping-url-local-directory

ERROR: Either the server is overloaded or there was an error in a CGI script – Apache Server in XAMPP

Windows XP Pro SP 2
XAMPP

Error Message:

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.
Error 500
localhost
02/27/08 13:04:31
Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.4

SOLVE:

Mod_rewrite needs to be enabled on xampp for htaccess to work. Its an apache server by the way so htaccess does work.

Find the file called httpd.conf, it should be located in
XAMPPInstallDirectory\apache\conf\

Open with notepad and find this line
#LoadModule rewrite_module modules/mod_rewrite.so
Remove the #, save it, restart apache (if running).

WordPress Tutorial – Adding A Widget Area To Your Theme Files

Its a fairly simple process, which involves 2 steps:

1. Register The Widget

To register the new widget you need to open the functions.php file in your WordPress themes editor.

Add the following code to the functions file, making sure you place it in between php tags:

if ( function_exists('register_sidebar') ){
    register_sidebar(array(
        'name' => 'my_mega_menu',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '',
        'after_title' => '',
));
}

Give the widget area a name – e.g. my_mega_menu and in the before/after options you can place code which you wish to appear wrapped around either the widget itself or the title.

Since we are wanting to use one of the menu widget themes, which come with plugins we dont want to wrap it in the standard widget tags, which may interfere with the CSS.

For this example we have just wrapped it in a div tag with the id – my-mega-menu-widget.

2. Add The Widget Code To Your Theme

Now we can add the code that will call the widget to the correct location in our theme files. Since we are creating a horizontal mega menu we obviously want to display this in the header.

In your WordPress themes editor open the header.php file.

Find the location where you want to place the menu and add the following code to the header.php file:

< ?php /* Widgetized sidebar */
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('my_mega_menu') ) : ?>< ?php endif; ?>

Make sure that you change the “my_mega_menu” text to be the same as the name you gave to your widget area in the functions file.

Save the changes to the header.php file

If you now go to the widget area in WordPress admin you should see a new widget area in the right hand column with the name of your widget.

Sources: http://www.designchemical.com/blog/index.php/wordpress-tips/wordpress-tutorial-adding-a-widget-area-to-your-theme-files

Content Divider, Support Writing & Editing Splitting Content in WordPress

We can put more link in a a post/page by just adding

<!-more–>

We can split a post/page up into different web pages so that is has pagination? All you have to do is type:

<!--nextpage-->

into the HTML editor where you would like your page breaks to appear.

You can use it throughout a long post to make two, three, four, or more pages out of the single post.

When you view your post on your site, the multi-page links appear as links at the bottom. The links below are an example of the feature in action.

How to export HTML Table into Excel via PHP

Create one variable and save whole table as string to that variable and just add below headers lines

//Header information
$header = "Header1" . "\t";
$header .= "Header2" . "\t";

//Reading the data thro' POST
$data= $_POST['header1']. "\t";
$data .= $_POST['header2'] . "\t";

header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=xyz.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";

download sample file

Steps for how to move Mysql database from default drive to other Drive!!!

Steps for how to move Mysql database from C: drive to D or any other Drive!!!

Step 1:

Cut the folder of database which you want to move from mysql c: data folder

For e.g. in my case

Database path:  C:\Program Files (x86)\MySQL\MySQL Server 5.0\data

Database name: tejash

Continue reading Steps for how to move Mysql database from default drive to other Drive!!!