Sunday, June 26, 2016

Execute php inside WordPress widget without plugin

Execute php inside WordPress widget without plugin

Hi Firends Hope you are doing good.Today I am going to tell how we can excute php code inside wordpress widget. Sometimes in your theme you want to excute custom php code in a widget,Because you want to display information according to the category, Or just simply you want to excute php code inside the widget. There are lot of plugins are available to run custom php code inside widget area.I will not recommend to Install Plugin, because plugin will consume extra resources to complete this task.but rather than installing a plugin this simple job can be done simply adding in functions.php file of your theme these few lines. Step1: Copy this Code and Paste in functions.php inside theme folder
function execute_php_text_widget($html){
 if(strpos($html,"<"."?php")!==false){ 
  ob_start(); 
  eval("?".">".$html);
  $html=ob_get_contents();
  ob_end_clean();
 }
 return $html;
}
add_filter('widget_text','execute_php_text_widget',100);
Which will turn the default Text widget into a php enabled widget. For Testing Purpose Just Paste This Code in Text Widget
//Hello World
<?php echo "Hello World!" ?>

Wednesday, June 22, 2016

Google Maps Tutorials for Beginners

Google Maps Tutorials for Beginners

Google Maps is a free Javascript API that allows you to integrate google Maps in your Webssite or mobile applicaation.Google Maps provides various types of geographical information. Google Maps has a JavaScript API to integrate and customize maps and display on your webpages. This Article is about Google Maps API (Application Programming Interface). Google Maps Tutorials for Beginners explains how you can integrate Google Maps on your webpages.

There are many ways to add a Google Map on your web page. Google offers a variety of maps you can use according to your needs.

Basic Example of Google Map without API Key

<!DOCTYPE html>
<html>

   <head>
      <script src = "http://maps.googleapis.com/maps/api/js"></script>
      
      <script>
         function loadMap() {
   
            var mapOptions = {
               center:new google.maps.LatLng(20.593684, 78.96288), zoom:12,
               mapTypeId:google.maps.MapTypeId.ROADMAP
            };
    
            var map = new google.maps.Map(document.getElementById("sample"),mapOptions);
         }
      </script>
      
   </head>
   
   <body onload = "loadMap()">
      <div id = "sample" style = "width:570px; height:580px;"></div>
   </body>
   
</html>
for Detailed information Visit Google API Console

Friday, June 17, 2016

How to Change the Login Logo in WordPress

How to Change the Login Logo in WordPress

Hello friends,hope you are doing good. Today again i am here to share my knowledge in context with WordPress.Many of you are eager to know that How to Change the Login Logo in WordPress.Enter your website name in URL bar with /wp-admin ex- www.example.com/wp-admin.After that,you can see the login page with default WordPress logo. Many of you want to use your desired logo instead of default logo,so i am here with the snippets.Through this snippet you can easily replace default WordPress logo with the desired logo.
So Copy below mentioned code and paste in your functions.php.

Change WordPress login Logo Code

This is the code snippet to change the logo on the wordpress login screen.
All you have to do just copy this code and paste in your functions.php file and change the wordpress logo with your custom logo that you want to use and it's done
function custom_admin_login_logo() {
    echo '<style type="text/css">
        h1 a { background-image:url(/images/logo.jpg) !important; }
    </style>';
}

add_action('login_head', 'custom_login_logo');

Change Logo Link

To change the link of your logo so the logo links to your WordPress site, copy the following WordPress hook and paste it in the functions.php:
function my_login_logo_url() {
    return home_url();
}
add_filter( 'login_headerurl', 'my_login_logo_url' );

function my_login_logo_url_title() {
    return 'Your Site Name and Info';
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );
The above snippets will change the link of your blog url and will change the title of the link to whatever you want That's all you have to do for More reference you can visit on this link Customizing_the_Login_Form

Sunday, June 12, 2016

Custom Page Template in Wordpress


Wordpress is very rapidly growing CMS in world.Today I am Going to tell about, How to Create Custom Page Template Wordpress. With wordpress we can design a page with simple HTML/CSS, and installs it in our WordPress site. All that needed is to simply add the following code into the top of your custom HTML page and save it with .php extension.

<?php /* Template Name: About*/ ?>

After adding the code, save this page as about.php and upload it to your current theme folder (../wp-content/themes/your-theme-name). Once the file is uploaded, create a new page and choose the template About under ‘Page Attributes’. Publish the page to see it live.

Visit official Wordpress Codex for More Information

Custom Page Templates
0