7 Aug 2015

Display content of a specific page on home page (Wordpress)


if ( is_home() ) {
  echo get_post_field('post_content', '419');
}


or


                $id=419;
$post = get_post($id);
$content = apply_filters('the_content', $post->post_content);
echo $content;  

27 Jun 2015

Disable Update Notifications and Maintenance Nags in WordPress

Insert the following code the functions.php file of your active theme. This code disables all the updates notifications regarding plugins, themes & WordPress completely.



function remove_core_updates(){
   global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);
}

add_filter('pre_site_transient_update_core','remove_core_updates');
add_filter('pre_site_transient_update_plugins','remove_core_updates');
add_filter('pre_site_transient_update_themes','remove_core_updates');

18 Jun 2015

Adding links to the Top menu in Magento

Magento V 1.9.1

>rwd/template/page/html/topmenu.phtml

>add the following code

<?php
     $routeName = Mage::app()->getRequest()->getRouteName();
     $identifier = Mage::getSingleton('cms/page')->getIdentifier(); 
?>
<ul id="nav">

  <li class="level0 home level-top <?php if($routeName == 'cms' && $identifier == 'home') {echo " active";}?>">
  <a href="<?php echo $this->getBaseUrl(); ?>" class="level-top"><span><?php echo $this->__('Home'); ?></span></a>
</li> 

26 Mar 2015

How to update Auto increment value in single column field using a single query

Go to your database ->SQL
and add the following query like your table field


SET @ordering = 0; UPDATE table SET increment = (@ordering := @ordering + 1) WHERE field = 'value' ORDER BY order_field;


29 Nov 2014

Enable WordPress Permalinks on Windows IIS

WordPress is written in PHP, and generally php runs better under apache on Linux, but you can run it on IIS on Windows machines. In fact this blog is running under Windows.*

If you find you have changed the permalinks options in your wordpress installation, but you find they don’t work,  first check if you are running on a Windows machine. On a shared hosting account, it should have said whether it was windows or linux, but at the least, if you have the option for asp.net, then you are on windows.

If you are on a Linux machine under apache, there are loads of resources for making sure permalink rewrites work. Running WordPress on windows however is much less common, so I thought I would post a quick fix for getting it to run under IIS7.

The trick involves adding a web.config file to your base installation. A web.config file is a configuration file used by Windows specifically for .net, but in this case if you are running wordpress you can trick IIS into passing the buck on files it can’t find to WordPress, that then handles it.

Simply ensure the URL Rewrite module is enabled on the IIS server (lots of hosts, including GoDaddy, have this enabled, but talk to your hosting company if it doesn’t), then add the following web.config file to the base of your WordPress installation.

Solution

Step: 01
>Open up a text editor and create a new file
>Copy/paste in the code that follows(code 1 or code 2) into your new text file.
>Save the file as web.config
>Upload the file to the root of your WordPress installation

Step: 02
>Log into your WordPress install  Dashboard –> Settings –> Permalinks and set it to Post name and click Save Changes.

You should now have Pretty Permalinks on a Windows server!

Code 1

<rewrite>
 <rules>
 <rule name="Main Rule" stopProcessing="true">
 <match url=".*" />
 <conditions logicalGrouping="MatchAll">
 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
 </conditions>
 <action type="Rewrite" url="index.php" />
 </rule>
 </rules>

</rewrite>


Code 2

<?xml version="1.0"?>

<configuration>

  <system.webServer>

    <rewrite>

      <rules>

        <rule name="Main Rule" stopProcessing="true">

          <match url=".*" />

          <conditions logicalGrouping="MatchAll">

            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />

          </conditions>

          <action type="Rewrite" url="index.php" />

        </rule>

      </rules>

    </rewrite>

  </system.webServer>


</configuration>