Monday 25 February 2013

How to remove link in customer page in magento

First Add this function in /app/code/core/Mage/Customer/Block/Account/Navigation.php


    public function removeLinkByName($name) {
       unset($this->_links[$name]);
    }


Then Go to /app/design/frontend/default/your theme folder/layout and create local.xml

//Add this code in local.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <customer_account>
   <reference name="customer_account_navigation">

<!-- To remove the item Account Dashboard you have to add this line of code -->

      <action method="removeLinkByName"><name>account</name></action>

<!-- To remove the item Account Information you have to add this line of code -->
    
     <action method="removeLinkByName"><name>account_edit</name></action>

<!-- To remove the item Address Book you have to add this line of code -->
    
     <action method="removeLinkByName"><name>address_book</name></action>

<!-- To remove the item My Orders you have to add this line of code -->
    
     <action method="removeLinkByName"><name>orders</name></action>

<!-- To remove the item Recurring Profiles you have to add this line of code -->

              <action method="removeLinkByName"><name>recurring_profiles</name></action>

<!-- To remove the item Billing Agreements you have to add this line of code -->

              <action method="removeLinkByName"><name>billing_agreements</name></action>

<!-- To remove the item My Downloadable Products you have to add this line of code -->

              <action method="removeLinkByName"><name>downloadable_products</name></action>

<!-- To remove the item My Tags you have to add this line of code -->

               <action method="removeLinkByName"><name>tags</name></action>

<!-- To remove the item My Product Reviews you have to add this line of code -->

              <action method="removeLinkByName"><name>reviews</name></action>

<!-- To remove the item My Wishlist you have to add this line of code -->

              <action method="removeLinkByName"><name>wishlist</name></action>

<!-- To remove the item Newsletter Subscriptions you have to add this line of code -->

              <action method="removeLinkByName"><name>newsletter</name></action>


<!-- To remove the item My Application you have to add this line of code -->

              <action method="removeLinkByName"><name>OAuth Customer Tokens</name></action>

      </reference>   
  </customer_account>
</layout>

Wednesday 13 February 2013

How to pull over Blog From one site to another site in wordpress


Please add this code when you want to show blog

<?php

include_once(ABSPATH . WPINC . '/feed.php');
include_once(ABSPATH . WPINC . '/SimplePie.php');

$rss = fetch_feed('/category/blog/feed/');  // Add your Url which you want to pull over blog

if (!is_wp_error( $rss ) ) :
$maxitems = $rss->get_item_quantity(5);
$rss_items = $rss->get_items(0, $maxitems);
endif;
?>

<?php 
function get_first_image_url($html)
{
     if (preg_match('/<img.+?src="(.+?)"/', $html, $matches)) 
    {
        return $matches[1];
    }
}
?> 

<?php
function shorten($string, $length)
{
     $suffix = '&hellip;';
     $short_desc = trim(str_replace(array("r","n", "t"), ' ', strip_tags($string)));
     $desc = trim(substr($short_desc, 0, $length));
     $lastchar = substr($desc, -1, 1);
     if ($lastchar == '.' || $lastchar == '!' || $lastchar == '?') $suffix='';
     $desc .= $suffix;
     return $desc;
}
?>

<ul class="rss-items" id="wow-feed">
<?php
if ($maxitems == 0) echo '<li>No items.</li>';
else
foreach ( $rss_items as $item ) : ?>
<li class="item">
<span class="rss-image">
<?php echo '<img src="' .get_first_image_url($item->get_content()). '"/>'; ?>
</span>
<span class="data">
<h5><a href='<?php echo esc_url( $item->get_permalink() ); ?>' title='<?php echo esc_html( $item->get_title() ); ?>'> <?php echo esc_html( $item->get_title() ); ?></a></h5>
<span class="date-image">&nbsp;</span><small><?php echo $item->get_date('F Y'); ?> </small>
<span class="comment-image">&nbsp;</span><small><?php $comments = $item->get_item_tags('http://purl.org/rss/1.0/modules/slash/', 'comments');?><?php $number = $comments[0]['data']; ?>
<?php if ($number == '1'){ echo $number."&nbsp;". "Comment"; } else {echo $number. "&nbsp;"."Comments";}?></small>
<p><?php echo shorten($item-> get_description(),'150');?></p>
</span>
</li>
<?php endforeach; ?>
</ul>