Bootstrap Templates Bundle

Sunday, October 20, 2013

How to Creating a PayPal Sandbox Test Account



The first thing you need to do is to login to the PayPal developer website: http://developer.paypal.com

Use your existing PayPal username and password to login. Once logged in you’ll arrive at the Dashboard. Navigate to Applications → Sandbox accounts

Now we’ll need to create 2 test accounts – 1 for the merchant (representing your shop’s PayPal account) and 1 for a buyer (representing a customer).

On your website: 
Select checkbox: Enable PayPal standard
Use the merchant test account email you created above for the PayPal & Receiver email
Select checkbox: Enable PayPal sandbox

Difference Between PayPal Express Checkout and Website Payments Standard?

If you use PayPal Express Checkout, when your customers check out, they will be directed to a page that requires them to log into their PayPal account or create a new one. Therefore, this is the best option if you anticipate that most of your customers either have a PayPal account or will sign up for an account on checkout.
It may also improve sales; according to PayPal’s website, the Express Checkout button "can increase sales by 14% on average*" and has "conversion rates [that] are 23% higher than standard checkout at some of today's largest online retailers.**"

If you use PayPal Website Payments Standard, when your customers check out, they will be directed to a page that allows them to log into their PayPal account or pay by credit card without having to sign up for a PayPal account. This is the best option if you anticipate that most of your customers will not want to sign up for a PayPal account.

Which is best for me?

PayPal Website Payments Standard allows users the choice of signing in or not signing in, and can be considered the default choice; PayPal Express Checkout can be more efficient for PayPal users and may facilitate sales.
It may depend on whether or not you also have a credit card processing option; if you do, you can use PayPal Express Checkout, since the customer will only need to use this option to pay with PayPal funds. If PayPal is your only payment method, you may want to use PayPal Website Payments Standard so that your customers have the option of using a credit card.

Why can't I use both options with Shopping Cart Creator?

If you try to enable both options in the Payment section of Shopping Cart Creator, you will get a warning message that says "Only one PayPal payment method can be used," which will then prompt you to disable one of these methods. Since one method requires that users sign in to PayPal and the other doesn't require users to sign in to PayPal, they contradict each other. Consequently, you can only use one method or the other.

Tuesday, October 1, 2013

How to make website content copy protected

Watermark Your Photos
Add watermark on your images. You can use this website http://picmarkr.com/ for adding watermark on images for your website.

Disable the Right Click Function: 
It is another way to protect your content to copy by right click.

Use this below code between <body> tag of your website 

<script language=JavaScript>
<!--
var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// --> 
</script>

By using Tynt.com
Go to Tynt.com Create an account here. Click on get the code.This is a tool that automatically produces a backlink right to your site when an individual steals your web content. The back links give you the authority and page rank so you can get the top result in the search engines. This will create more web traffic to your site so you can get paid for the content you wrote.

Sunday, September 22, 2013

How to convert HTML menu to wordpress Menu

When you need to convert HTML menu to wordpress menu, this tutorial will be very helpful for you.


At first I show you the code for sample HTML menu code:

<div id="nav">
<nav class="jquery-menu clearfix">
<ul class="menu">
<li class="current active"><a href="index.html">Home</a></li>
<li class="parent"><a href="menu.html">Menu</a>
<ul>
<li><a href="menu.html">Breakfast</a></li>
<li><a href="menu.html">Lunch</a></li>

<li><a href="menu.html">Dinner</a></li>
<li><a href="menu.html">Desserts</a></li>
<li><a href="menu.html">Drinks</a></li>
</ul>
</li>
<li><a href="typography.html" >Typography</a></li>
<li><a href="blog.html">Blog</a></li>

<li><a href="gallery.html">Gallery</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</div>

CSS code for above HTML code is :

#nav
{
padding: 0 5px;
height: 40px;
/*float: right;*/
position: absolute;
top: 0;
right: 20px;
font-family: Helvetica, arial, sans-serif;

background: url(../images/paper.jpg);
border: 1px solid #dcd7d2;
border-top: 0;

-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-border-bottom-left-radius: 4px;
-border-bottom-right-radius: 4px;
}

#nav ul
{
z-index: 20;
}

#nav li 
{
list-style: none;
float: left;
position: relative;
margin: 0;
padding: 5px 0 40px;
}

#nav a
{
float: left;
padding: 7px 15px 11px;
min-height: 12px; /* min-height will allow an item to occupy multiple lines */
line-height: 100%;
text-decoration: none;
font-size: 1.1em;
text-shadow: 0 1px 0 #fff;
font-style: normal;

color: #241506;
}

#nav li.parent > a
{
background: url(../images/nav.png) no-repeat 50% -58px;
}

#nav li.active
{
background: url(../images/nav.png) no-repeat 50% 41px;
}

/* Second level
------------------------------------------ */

#nav li ul
{
position: absolute;
top: 40px;
left: -5px;
display: none;
padding: 10px 0 5px !important; /* Important so the slide functions don't overwrite it */

background: url(../images/paper.jpg);
border: 1px solid #dcd7d2;
border-top: 0;

-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-radius-bottomleft: 4px;
-webkit-border-radius-bottomright: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}

#nav li li
{
margin: 0;
border: 0;
padding: 0 5px;
}

#nav li li a
{
width: 140px;
display: block;
float: none;
padding: 10px;
}

#nav li li.parent > a
{
background: url(../images/nav.png) no-repeat 100% -122px;
}

/* Third level
------------------------------------------ */

#nav ul ul ul
{
top: 0;
left: 100%;
padding: 5px !important;
margin: -5px 0 0 0px;

-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}

Now, need to convert this HTML menu to wordpress menu:
Step-1:               At first copy paste the below code to your functions.php file

    if ( function_exists( 'register_nav_menus' ) ) {
    register_nav_menus(
    array(
     'menu_1' => 'Menu 1',      
               
    )
    );
    }

Step-2:                  Now change the above red color code  <div id="nav">  by <div id="cssmenu">

Step-3:                 Change the blue color HTML code by

<?php wp_nav_menu( array( 'theme_location' => 'menu_1' ) ); ?>

Step-4:                 As we change the <div id="nav">  by <div id="cssmenu">, so we need to change the all  css code       #nav by   #cssmenu


below sample changed: 

#cssmenu
{
padding: 0 5px;
height: 40px;
/*float: right;*/
position: absolute;
top: 0;
right: 20px;
font-family: Helvetica, arial, sans-serif;

background: url(../images/paper.jpg);
border: 1px solid #dcd7d2;
border-top: 0;

-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-border-bottom-left-radius: 4px;
-border-bottom-right-radius: 4px;
}

#cssmenu ul
{
z-index: 20;
}

#cssmenu li 
{
list-style: none;
float: left;
position: relative;
margin: 0;
padding: 5px 0 40px;
}

#cssmenu a
{
float: left;
padding: 7px 15px 11px;
min-height: 12px; /* min-height will allow an item to occupy multiple lines */
line-height: 100%;
text-decoration: none;
font-size: 1.1em;
text-shadow: 0 1px 0 #fff;
font-style: normal;

color: #241506;
}

#cssmenu li.parent > a
{
background: url(../images/nav.png) no-repeat 50% -58px;
}

#cssmenu li.active
{
background: url(../images/nav.png) no-repeat 50% 41px;
}

/* Second level
------------------------------------------ */

#cssmenu li ul
{
position: absolute;
top: 40px;
left: -5px;
display: none;
padding: 10px 0 5px !important; /* Important so the slide functions don't overwrite it */

background: url(../images/paper.jpg);
border: 1px solid #dcd7d2;
border-top: 0;

-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-radius-bottomleft: 4px;
-webkit-border-radius-bottomright: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}

#cssmenu li li
{
margin: 0;
border: 0;
padding: 0 5px;
}

#cssmenu li li a
{
width: 140px;
display: block;
float: none;
padding: 10px;
}

#cssmenu li li.parent > a
{
background: url(../images/nav.png) no-repeat 100% -122px;
}

/* Third level
------------------------------------------ */

#cssmenu ul ul ul
{
top: 0;
left: 100%;
padding: 5px !important;
margin: -5px 0 0 0px;

-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;

}

Tuesday, September 17, 2013

How to show paragraph, image and HTML tags in wordpress excerpt

This tutorial will be very helpful for Newspaper theme, Blog theme, Magazine theme etc. Sometimes it is necessary to show images, paragraph in home page excerpt  from a wordpress post. Normally wordpress excerpt not show any paragraph, images and other HTML tags. But if you use this below code it will help you to show all types of HTML tags from a post in excerpt.

/******************************************************************************
* @Author: Boutros AbiChedid
* @Date:   June 20, 2011
* @Websites: http://bacsoftwareconsulting.com/ ; http://blueoliveonline.com/
* @Description: Preserves HTML formating to the automatically generated Excerpt.
* Also Code modifies the default excerpt_length and excerpt_more filters.
* @Tested: Up to WordPress version 3.1.3
*******************************************************************************/
function custom_wp_trim_excerpt($text) {
$raw_excerpt = $text;
if ( '' == $text ) {
    //Retrieve the post content.
    $text = get_the_content('');
    //Delete all shortcode tags from the content.
    $text = strip_shortcodes( $text );
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]&gt;', $text);
   
    $allowed_tags = ''; /*** MODIFY THIS. Add the allowed HTML tags separated by a comma.***/
    $text = strip_tags($text, $allowed_tags);
   
    $excerpt_word_count = 55; /*** MODIFY THIS. change the excerpt word count to any integer you like.***/
    $excerpt_length = apply_filters('excerpt_length', $excerpt_word_count);
   
    $excerpt_end = '[...]'; /*** MODIFY THIS. change the excerpt endind to something else.***/
    $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);
   
    $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
    if ( count($words) > $excerpt_length ) {
        array_pop($words);
        $text = implode(' ', $words);
        $text = $text . $excerpt_more;
    } else {
        $text = implode(' ', $words);
    }
}
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'custom_wp_trim_excerpt');



Changing/modification requirement according to you need:
Change-1: In the above code  where it shows "MODIFY THIS. Add the allowed HTML tags separated by a comma."
Change the code  $allowed_tags = '';

//Separate tags by commas. Add or Remove tags as you wish.
$allowed_tags = '<p>,<a>,<em>,<strong>,<img>';

It will helps you to show paragraph, link, strng, img tag of HTML from post content to post excerpt.

Change-2:
Where it shows  /*** MODIFY THIS. change the excerpt word count to any integer you like.***/

If you like to change the automatically generated excerpt length fromthe default 55 words
//Replace line 25 of the MAIN_CODE with this:
$excerpt_word_count = 65; /* Choose any number you like. */

If you want to modify the excerpt length based on one category

//Replace line 25 of the MAIN_CODE with this:
if (in_category(4)) {  //For posts belonging to category ID 4
   $excerpt_word_count = 65; //return 65-word length excerpt.
} else {
    $excerpt_word_count = 40; //for all others, return 45 words.
}

If you want to modify the excerpt length based on multiple categories

//Replace line 25 of the MAIN_CODE with this:

if(in_category(array(4,40))) {  //For posts belonging to category IDs 4 and 40

    $excerpt_word_count = 65; //return 65 words for the excerpt.

} else {

     $excerpt_word_count = 40; //for all others, return 40 words.

}


Change-3: In the above code  where it shows
/*** MODIFY THIS. change the excerpt endind to something else.***/

By default WordPress outputs an un-linked “[...]” at the end of each excerpt, which is not useful for Accessibility and SEO purposes. If you want to modify the excerpt more string with a link,  replace it with this:

//Replace line 28 of the MAIN_CODE with this:
$excerpt_end = ' <a href="'. get_permalink($post->ID) . '">' . '&raquo; Continue Reading.' . '</a>';

If you want to add the post title to your link in the excerpt,

//Replace line 28 of the MAIN_CODE with this:
$excerpt_end = ' &#8230;<br /><a href="'. get_permalink($post->ID) . '">' . '&raquo; Continue Reading: '. get_the_title() . '</a>';

All changes done. For you Here i add a sample code below that I've added to my
wordpress themes.
function custom_wp_trim_excerpt($text) {
$raw_excerpt = $text;
if ( '' == $text ) {
    $text = get_the_content('');
    $text = strip_shortcodes( $text );
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]&gt;', $text);
   
    /***Add the allowed HTML tags separated by a comma.***/
    $allowed_tags = '<p>,<a>,<em>,<strong>,<img>';
    $text = strip_tags($text, $allowed_tags);
   
    /***Change the excerpt word count.***/
    $excerpt_word_count = 60;
    $excerpt_length = apply_filters('excerpt_length', $excerpt_word_count);
   
    /*** Change the excerpt ending.***/
    $excerpt_end = ' <a href="'. get_permalink($post->ID) . '">' . '&raquo; Continue Reading.' . '</a>';
    $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);
   
    $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
    if ( count($words) > $excerpt_length ) {
        array_pop($words);
        $text = implode(' ', $words);
        $text = $text . $excerpt_more;
    } else {
        $text = implode(' ', $words);
    }
}
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'custom_wp_trim_excerpt');


Sunday, September 15, 2013

AdSense Code for TESTING

Here I give sample AdSense code for testing. 
Red Color will be changed by your own. 
Also you can use Google AdSense Generator for crating code by your own publication ID 
<script type="text/javascript"><!--
    google_ad_client = "ca-pub-5130888087776673";  
	/* HorizontalLeaderboard */  
    google_ad_slot = "5926145549"; 
    google_ad_width = 728;
    google_ad_height =  90; 
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>

How to show HTML and PHP code on a site?

Sometimes in tutorial blog or in some other cases it's needed to show html/php  code onto website.

Suppose you want to show  <?php echo wp_ruby_1(); ?> then you can use the below codes

system1:   <pre>&lt?php echo wp_ruby_1(); ?&gt </pre>
or
system2:   <?php highlight_string('<?php echo wp_ruby_2(); ?>'); ?>


System 1 can be used for both HTML/PHP but system 2 can be used for only php code

Thursday, September 12, 2013

How to enable keyboard shortcuts for WordPress

To enable keyboard shortcuts for WordPress
Administration > Users > Your Profile and Check the Keyboard shortcuts Check box to enable it.

For comment moderation use the these shortcuts

Press A to approve the selected comment.
Press S to mark as spam comment.
Press D to Delete the selected comment
Press Z to restore the trashed comment.
Keyboard Shortcuts for WordPress Rich Text Editor:

You can use many keyboard shortcuts while creating a new post with WordPress Rich text editor. Write faster without using mouse using these WordPress Editor shortcut keys. Use Ctrl +Letter for Windows and Linux and Command + Letter for  Macintosh.


Alt + Shift + letter Shortcuts:

Alt+Shift+ N      -  Check Spelling

Alt+Shift+ E      -  Switches to HTML mode

Alt+Shift+ P      -  Insert Page Break tag

Alt+Shift+ M     –  Insert Image

Alt+Shift+ H      -  Help

Text Decoration:

Alt+Shift+ B      -  Makes the selected text Bold

Alt+Shift+ I        -   Makes the selected text Italic

Alt+Shift+ D       –   Strike through outdated links and information.

Alt+Shift+ U      -   Makes an Unordered List

Alt+Shift+ O      -   Makes an Ordered List

Alt+Shift+ Q      -  Blockquote

Text Alignment:

Alt+Shift+ L        -  Align Text Left

Alt+Shift+ C       –  Align Text Center

Alt+Shift+ R       –  Align Text Right

Alt+Shift+ J       –   Justify Text

Linking:

Alt+Shift+ A       –  Insert or Edit Link

Alt+Shift+ S        -  Unlink or Remove Link

Alt +                        - Wider (Widens the Editor window)

Alt  -                        - Narrower(Shrinks the Editor window)

Alt 0                        - Default Width


Ctrl+Letter Shortcut Keys:

CTRL + U        - Underlines the selected Text

CTRL + B        -  Bold   (Alt+Shift+B also works)

CTRL + I         – Italic (Alt+Shift+I also works)

CTRL + 1        -  Heading 1

CTRL + 2        -  Heading 2

CTRL + 3        -  Heading 3

CTRL + 4        - Heading 4

CTRL + 5        -  Heading 5

CTRL + 6        -  Heading 6

CTRL + 9        -  Address

CTRL +Z         –  Undo

CTRL +Y        -  Redo

CTRL +A        -   Selects all the text

CTRL +C        -  Copies the Selected text

CTRL +X        -  Cuts the Selected text

CTRL +V       –  Pastes the copied text

How to add extra buttons to WordPress visual post editor

To make more user friendly of your wordpress theme, you can add extra buttons to WordPress visual post editor by adding some simple code into your functions.php file.

It's better to add this code just before the last line of your functions.php file and after adding this below code go to Posts > Add New. Then you see the the difference.

//Add Extra Buttons to WordPress Visual Post Editor

function enable_more_buttons($buttons) {
$buttons[] = 'fontselect';
$buttons[] = 'fontsizeselect';
$buttons[] = 'backcolor';
$buttons[] = 'image';
$buttons[] = 'media';
$buttons[] = 'anchor';
$buttons[] = 'sub';
$buttons[] = 'sup';
$buttons[] = 'hr';
$buttons[] = 'wp_page';
$buttons[] = 'cut';
$buttons[] = 'copy';
$buttons[] = 'paste';
$buttons[] = 'newdocument';
$buttons[] = 'code';
$buttons[] = 'cleanup';
return $buttons;
}
add_filter("mce_buttons_3", "enable_more_buttons");



Tuesday, September 10, 2013

Add Cache-Control Headers in your root .htaccess file

By adding cache control header into your .htaccess file, it can be possible to speed up your website.
Here is the way  how to add Cache-Control Headers in your root .htaccess file

# 480 weeks
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

# 2 DAYS
<FilesMatch ".(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>

# 2 HOURS
<FilesMatch ".(html|htm)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>

Explanation: The first portion of the code will cache your .ico, .jpg, .png, .css, .js, .swf file for 480 days. You can change this 480 days by your one by changing red color portion
480weeks= 480*7*24*60*60=290304000


How to test website speed and perormance

There is some website/tools which will help you to test your website and performance. It is necessary to speed up your website. After testing your website speed you can take necessary steps to increase your website speed.

Website speed and performance testing website link:
http://tools.pingdom.com/fpt/
https://developers.google.com/speed/pagespeed/insights
http://www.webpagetest.org/
http://www.serverspeed.com/



Friday, September 6, 2013

Adding Google Custom Search Engine (CSE) on your website

Most of the website use search option on their website. Visitor can search and get anything easily by search option. It is better to add a custom search engine by Google on to website. Here I show you how to add Google Custom Search Engine (CSE) on your website. At first check two website for sample

http://deshtimes24.com/
http://banglanews24.com/

Deshtimes24 is developed by me. Now I'm telling how to add this custom search engine.

 <script language="javascript" type="text/javascript" src="http://bestcareerbd.com/Clients/cse-search-box.js"></script>
<script language="javascript" type="text/javascript" src="http://www.google.com/jsapi"></script>

Add this code between  <head> tag  and also put the below code where you want to show the search option. Also download cse-search-box.js file by visiting  http://bestcareerbd.com/Clients/cse-search-box.js

 <form class="srch_submit" action="http://www.google.com.bd/cse" id="cse-search-box" target="_blank">
            <input type="hidden" name="cx" value="000558933243491534581:qmhvj6dv8n4" />
            <input type="hidden" name="ie" value="utf-8" />
            <div class="btnSearch" id="btnSearch">
              <input id="q" name="q" class="q bangla_font" style="" type="text" maxlength="100" value="Search..." />
                <input id="sa" name="sa" style="" type="submit" value="" />
            </div>           
</form>
  Red color code inside <form> tag will be changed by your own

Search engine unique ID: 000558933243491534581:qmhvj6dv8n4

To get this unique id visit https://www.google.com/cse/manage/create and create an account for your website.

CSS code for this. Add below code into your css file'

#btnSearch{float:right;overflow:hidden;margin-top:0px;}
#q{font-size:13px;height:28px;width:160px;border:0;background-image:url(http://bestcareerbd.com/Clients/search_box_button.jpg);padding:0;margin:0;float:left;padding:0 10px;color:#666;}
#sa{font-family:SolaimanLipi;color:#D60000;border:none;cursor:pointer;height:28px;width:30px;border:0;background-image:url(http://bestcareerbd.com/Clients/search_button.jpg);padding:0;cursor:pointer;margin:0;float:left;}

Tuesday, September 3, 2013

How to show category name by category id in wordpress

Here is will show you some way to get category name and link from category ID

/// Category link  from category Name

<?php
    // Get the ID of a given category
    $category_id = get_cat_ID( 'Category Name' );

    // Get the URL of this category
    $category_link = get_category_link( $category_id );
?>

<!-- Print a link to this category -->
<a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>


WordPress – Get Category Link By Category Id

<?php
echo get_category_link( "category_id_here" );
?>

WordPress – Get Category name By Category Id

<?php echo get_the_category_by_id(10); ?>

Yellow color color code some shows a error "Catchable fatal error: Object of class stdClass could not be converted to string in ..."

if showing Catchable fatal error:  then use bellow for category name 

<?php
$cat=1;
$yourcat = get_category($cat);
if ($yourcat) {
echo '<h2>' . $yourcat->name . '</h2>';
}
?>




Monday, September 2, 2013

How to show Bangla Date in a website

At first create a file suppose bangladate.php, then open it by a text editor, suppose: Notepad++
Then paste this below code and save


<?php
function bn_date($str)
 {
     $en = array(1,2,3,4,5,6,7,8,9,0);
    $bn = array('১','২','৩','৪','৫','৬','৭','৮','৯','০');
    $str = str_replace($en, $bn, $str);
    $en = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
    $en_short = array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
    $bn = array( 'জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর' );
    $str = str_replace( $en, $bn, $str );
    $str = str_replace( $en_short, $bn, $str );
    $en = array('Saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday');
     $en_short = array('Sat','Sun','Mon','Tue','Wed','Thu','Fri');
     $bn_short = array('শনি', 'রবি','সোম','মঙ্গল','বুধ','বৃহঃ','শুক্র');
     $bn = array('শনিবার','রবিবার','সোমবার','মঙ্গলবার','বুধবার','বৃহস্পতিবার','শুক্রবার');
     $str = str_replace( $en, $bn, $str );
     $str = str_replace( $en_short, $bn_short, $str );
     $en = array( 'am', 'pm' );
    $bn = array( 'পূর্বাহ্ন', 'অপরাহ্ন' );
    $str = str_replace( $en, $bn, $str );
     return $str;
 }
//Change below codes according to your requirement .
//__________________________________________
echo bn_date(date('l, d M Y, h:i a'));
//__________________________________________
?>


Now, paste the below code , where you want to show

 <?php
include_once"/wp-content/themes/deshtimes/bndate.php"; ?>

red color will be your file url/link.

Result:   বৃহস্পতিবার, ০2 ফেব্রুয়ারী ২০১৩, ০৭:৩৯ অপরাহ্ন

you can change the pattern by 

echo bn_date(date('l, d M Y, h:i a'));

l=Day in full text
D=Day in short text
Y=Year
M=Month in full text
d=Day in Numeric format
h=Hour in Numeric
i=Minute in Numeric
a=Time in text like "AM and PM , in bangla 
'পূর্বাহ্ন', 'অপরাহ্ন'

"

Monday, August 26, 2013

Adding Custom Meta Boxes in Wordpress

Add below code into wordpress functions.php file

add_action( 'add_meta_boxes', 'custom_header_img' );
function custom_header_img() {
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
if ($post_type == 'ad_post_type') {$post_type = 'page';}
add_meta_box( 'custom_header_img_url', 'Custom Header Image URL', 'custom_header_img_add', $post_type, 'normal', 'high' );
    }
}


function custom_header_img_add( $post )
{
$values = get_post_custom( $post->ID );
$chi_url = isset( $values['custom_header_img'] ) ? esc_attr( $values['custom_header_img'][0] ) : '';
wp_nonce_field( 'custom_header_img_add_nonce', 'meta_box_nonce_chi' );
?>

<span style="font-size:11px; color:#999; line-height:1.3;">Header Image will only work if "Custom Header Element" chosen.<br/>
Enter image full URL (include http://)</span>
<p><input type="text" name="custom_header_img" id="custom_header_img" value="<?php echo $chi_url; ?>" style="width:100%;" /> </p>

<?php
}


add_action( 'save_post', 'chi_meta_box_save' );
function chi_meta_box_save( $post_id )
{
// Bail if we're doing an auto save
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;

// if our nonce isn't there, or we can't verify it, bail
if( !isset( $_POST['meta_box_nonce_chi'] ) || !wp_verify_nonce( $_POST['meta_box_nonce_chi'], 'custom_header_img_add_nonce' ) ) return;

// if our current user can't edit this post, bail
if( !current_user_can( 'edit_post' ) ) return;

// now we can actually save the data
$allowed = array(
'a' => array( // on allow a tags
'href' => array() // and those anchords can only have href attribute
)
);


if( isset( $_POST['custom_header_img'] ) )
update_post_meta( $post_id, 'custom_header_img', esc_attr( $_POST['custom_header_img'] ) );
}

After adding this above code, check .//wp-admin/post-new.php, You can see a custom meta box by Custom Header Image URL named.

To show this on front end, add this code where you want to show
<?php echo get_post_meta($post->ID, 'custom_header_img', true); ?>
or
If you want add style then   <div style="color: red;float:left;"> <?php echo get_post_meta($post->ID, 'custom_header_img', true); ?></div>
or
<img class="custom_header_img" src="<?php echo get_post_meta($post->ID, 'custom_header_img', true); ?>">


You can add more custom meta boxes by only changing the red color portions. Suppose I want to add a custom field for word, So , I only change the all red color  custom_header_img  by custom_header_word

such as:
/*********************************************** CUSTOM meta Box for  word ***************************************************/

add_action( 'add_meta_boxes', 'custom_header_word' );
function custom_header_word() {
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
if ($post_type == 'ad_post_type') {$post_type = 'page';}
add_meta_box( 'custom_header_word_url', 'Custom Header Image Word', 'custom_header_word_add', $post_type, 'normal', 'high' );
    }
}


function custom_header_word_add( $post )
{
$values = get_post_custom( $post->ID );
$chi_url = isset( $values['custom_header_word'] ) ? esc_attr( $values['custom_header_word'][0] ) : '';
wp_nonce_field( 'custom_header_word_add_nonce', 'meta_box_nonce_chi' );
?>

<span style="font-size:11px; color:#999; line-height:1.3;">Header Image will only work if "Custom Header Element" chosen.<br/>
Enter image full URL (include http://)</span>
<p><input type="text" name="custom_header_word" id="custom_header_word" value="<?php echo $chi_url; ?>" style="width:100%;" /> </p>

<?php
}


add_action( 'save_post', 'chi_meta_boxword_save' );
function chi_meta_boxword_save( $post_id )
{
// Bail if we're doing an auto save
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;

// if our nonce isn't there, or we can't verify it, bail
if( !isset( $_POST['meta_box_nonce_chi'] ) || !wp_verify_nonce( $_POST['meta_box_nonce_chi'], 'custom_header_word_add_nonce' ) ) return;

// if our current user can't edit this post, bail
if( !current_user_can( 'edit_post' ) ) return;

// now we can actually save the data
$allowed = array(
'a' => array( // on allow a tags
'href' => array() // and those anchords can only have href attribute
)
);


if( isset( $_POST['custom_header_word'] ) )
update_post_meta( $post_id, 'custom_header_word', esc_attr( $_POST['custom_header_word'] ) );
}


Adding Custom editor buttons in wordpress

Add these below code into functions.php file:

/* Custom editor buttons */
function enable_more_buttons($buttons) {
  $buttons[] = 'hr';
  $buttons[] = 'sub';
  $buttons[] = 'sup';
  $buttons[] = 'fontselect';
  $buttons[] = 'fontsizeselect';

  return $buttons;
}
add_filter("mce_buttons_3", "enable_more_buttons");

How to add a ID column into wordpress Posts and pages

Add these below code to functions.php file  and after adding visit
../wp-admin/edit.php?post_type=page
and ../wp-admin/edit.php



/* Add Post ID column */
add_filter('manage_posts_columns', 'posts_columns_id', 5);
function posts_columns_id($defaults){
    $defaults['wps_post_id'] = 'ID';
    return $defaults;
}
add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2);
function posts_custom_id_columns($column_name, $id){
        if($column_name === 'wps_post_id'){
                echo $id;
    }
}
add_action('admin_head', 'id_column_style');
function id_column_style() {
    echo '<style type="text/css">.column-wps_post_id{width:5%;}</style>';
}


/* Add Page ID column */
add_filter('manage_pages_columns', 'pages_columns_id', 5);
function pages_columns_id($defaults){
    $defaults['wps_page_id'] = 'ID';
    return $defaults;
}
add_action('manage_pages_custom_column', 'pages_custom_id_columns', 5, 2);
function pages_custom_id_columns($column_name, $id){
        if($column_name === 'wps_page_id'){
                echo $id;
    }
}
add_action('admin_head', 'id_column_style');
function ids_column_style() {
    echo '<style type="text/css">.column-wps_page_id{width:5%;}</style>';
}

Thursday, August 1, 2013

How to Install the Facebook Like Box on Your Drupal Website also enable php code as input text format

Get facebook likebox code from facebook.com
suppose

<iframe scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/follow_button.1340179658.html#_=1344687471539&amp;id=twitter-widget-2&amp;lang=en&amp;screen_name=saranquardz&amp;show_count=true&amp;show_screen_name=true&amp;size=m" class="twitter-follow-button" style="width: 243px; height: 20px;" title="Twitter Follow Button"></iframe><iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdevsaran.drupal&amp;width=240&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:240px; height:258px;" allowtransparency="true"></iframe>

Then create a block and add avove code also select php code as input tex format




Do you know how to enable php code for input text format?
see below:

Go to Administration > Modules.
Scroll down to the PHP filter module and check the Enabled box. Press the Save Configuration button.
When you will add ant content/block select php code as input method. That's all

Saturday, July 6, 2013

How to install Module/Extension for opencart

Here is five steps to show, How to install Module/Extension for opencart

1. Unzip the files.
2. Upload the files INSIDE the "upload" folder to your OpenCart root folder. **NOTE: No file should get replaced!
3. Proceed to System > Users > User Groups and grant yourself access and modification permission.      (Optional)
4. In admin panel, go to "Extensions > Modules > Your extension name” and install and configure.
5. Add news from “Extensions > News”.


Tuesday, July 2, 2013

How to Install new Opencart Theme

After Downloading a theme free/premium, Extract your theme

After extracting you will get some some file. There will be read me and some help file also. Try to find
\yourt theme name\OpenCart 1.5.2.1\FILES TO UPLOAD\

Copy this folder and paste into your hosting
To find out which version of OpenCart your store is running on, log in to your admin panel and this should be displayed at the bottom of the page.

Inside FILES TO UPLOAD you will find three folders: admin, catalog and image. Upload those folders to the root directory you have installed OpenCart in.

Don't worry, it won't replace any core files :)

Then you need to go to your site admin panel
http://WWW.YOURWEBSITE.COM/STORE/admin/

Then go to Home-->System-->  Setting---> Insert --> Store--> Template


Choose template and click on save

Wokiee React eCommerce Template