Thursday, November 28, 2013

Custom Excerpt Length

By default the excerpt length is capped at 55 words. Many theme designers like to have the flexibility that is why WordPress lets you customize the excerpt length with this function:


function new_excerpt_length($length)

return 100;


add_filter(‘excerpt_length’, ‘new_excerpt_length’);



Custom Excerpt Length

Customize Excerpt More [...]

// custom excerpt ellipses for 2.9

function custom_excerpt_more($more)

return ‘…’;


add_filter(‘excerpt_more’, ‘custom_excerpt_more’);


/* custom excerpt ellipses for 2.8-

function custom_excerpt_more($excerpt)

return str_replace(‘[...]‘, ‘…’, $excerpt);


add_filter(‘wp_trim_excerpt’, ‘custom_excerpt_more’);

*/



Customize Excerpt More [...]

Display Twitter Followers Count and More

There are widgets that display Twitter followers count, but those are limited and ugly. You can use this function to customize the way your twitter followers count look on your blog. Simply paste the code below:


function rarst_twitter_user( $username, $field, $display = false )

$interval = 3600;

$cache = get_option(‘rarst_twitter_user’);

$url = ‘http://api.twitter.com/1/users/show.json?screen_name=’.urlencode($username);


if ( false == $cache )

$cache = array();


// if first time request add placeholder and force update

if ( !isset( $cache[$username][$field] ) )

$cache[$username][$field] = NULL;

$cache[$username]['lastcheck'] = 0;


// if outdated

if( $cache[$username]['lastcheck'] < (time()-$interval) )


// holds decoded JSON data in memory

static $memorycache;


if ( isset($memorycache[$username]) )

$data = $memorycache[$username];


else

$result = wp_remote_retrieve_body(wp_remote_request($url));

$data = json_decode( $result );

if ( is_object($data) )

$memorycache[$username] = $data;


if ( is_object($data) )

// update all fields, known to be requested

foreach ($cache[$username] as $key => $value)

if( isset($data->$key) )

$cache[$username][$key] = $data->$key;


$cache[$username]['lastcheck'] = time();


else

$cache[$username]['lastcheck'] = time()+60;


update_option( ‘rarst_twitter_user’, $cache );


if ( false != $display )

echo $cache[$username][$field];

return $cache[$username][$field];


Then place the following code where you want to display the count in your theme file:


echo rarst_twitter_user(‘wpbeginner’, ‘name’).’ has ‘.

rarst_twitter_user(‘wpbeginner’, ‘followers_count’).’ followers after ‘.

rarst_twitter_user(‘wpbeginner’, ‘statuses_count’).’ updates.’;



Display Twitter Followers Count and More

Adding an Author Image and Bio Box in WordPress, and Linking to a Google+ Profile

Sorry, no attachments exist.

Adding an Author Image and Bio Box in WordPress, and Linking to a Google+ Profile



Adding an Author Image and Bio Box in WordPress, and Linking to a Google+ Profile

All In One WP Security & Firewall

Sorry, no attachments exist.


A comprehensive, user-friendly, all in one WordPress security and firewall plugin for your site.


A COMPREHENSIVE, EASY TO USE AND WELL SUPPORTED WORDPRESS SECURITY PLUGIN


WordPress itself is a very secure platform. However, it helps to add some extra security and firewall to your site by using a security plugin that enforces a lot of good security practices.



All In One WP Security & Firewall

Sunday, November 24, 2013

PHP Time ago like facebook function

<?php

function ago($timestamp)

$difference = time() – strtotime($timestamp);

$periods = array(‘second’, ‘minute’, ‘hour’, ‘day’, ‘week’, ‘month’, ‘years’, ‘decade’);

$lengths = array(’60′, ’60′, ’24′, ’7′, ’4.35′, ’12′, ’10′);

for($j = 0; $difference >= $lengths[$j]; $j++) $difference /= $lengths[$j];

$difference = round($difference);

if($difference != 1) $periods[$j] .= “s”;

return “$difference $periods[$j] ago”;

echo ago(’2013-11-28 09:50:28′);

?>


PHP Time ago like facebook function

NextScripts: Social Networks Auto-Poster

Sorry, no attachments exist.
This plugin automatically publishes posts from your blog to your Social Network accounts such as Facebook, Twitter, Google+(Google Plus), Blogger, Tumblr, …

Automatically re-publishes blogposts to Facebook, Twitter, Google+, Pinterest, LinkedIn, Blogger, Tumblr, Delicious, Plurk, etc profiles and/or pages


NextScripts: Social Networks Auto-Poster

Magento product review on sidebar extension

Sorry, no attachments exist.

Magento product review on sidebar extension


Magento product review on sidebar extension

Wordpress Extension Add Link to Facebook

Sorry, no attachments exist.

Wordpress Extension Add Link to Facebook


Wordpress Extension Add Link to Facebook

Thursday, November 21, 2013

Saturday, November 16, 2013

Wordpress Extension Admin Drop Down Menu

Sorry, no attachments exist.

All admin links available in a neat horizontal drop down menu. Saves lots of screen real estate!

Wordpress Extension Admin Drop Down Menu


Wordpress Extension Admin Drop Down Menu

Wednesday, November 6, 2013

Custom Social networking sharing link

https://www.linkedin.com/cws/share?url=SITE_URL
http://twitter.com/home?status=SITE_URL
https://plus.google.com/share?url=SITE_URL
http://www.facebook.com/share.php?u=SITE_URL

Thursday, October 10, 2013

HTML and Javascript to share page on social networing site

<a href="#" onclick="window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;" class="icon">Google Icon</a>
            <a href="#" onclick="window.open('http://twitter.com/home?status='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;" class="icon">Twitter Icon</a>
            <a href="#" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;" class="icon">Facebook Icon</a>

Script for to remove the cache

make one cache-clear.php file into your root folder and paste following code:
  require_once (“app/Mage.php”); 
 umask(0); 
 Mage::run(); 
 Mage::app()->getCache()->clean(); 
 exit(“done”); 
 ?> 
can call that file with :http://yourdomainname/cache-clear.php

How To Setup Multiple Magento Stores and Web-site

There are numerous ways to setup multiple Magento stores that all share the same codebase and backend, but what method you use depends on your needs.
This article is written with cPanel in mind, though the methodologies listed below apply no matter what control panel you’re using. You will need Magento 1.4.x or greater installed too.
Jump To Section
(A)        Multi-Web-Site, Multi-Domain Setup :-
Follow Multi Web-Site and Multi Store Instructions.
1: Categories
First, will need to create our Categories.  Since all three websites will be sharing the same catalog, we will be using the default root Category in Catalog -> Categories -> Manage Categories and will be creating our categories under that root category (i.e. Clothing, Electronics, etc.).
These categories (Clothing, Electronics) should be set as both “Is Active” from the General Information tab and “Is Anchor” from the Display Settings tab for them to appear on the frontend of your Magento shop.  (***NOTE: If the websites will not be sharing the same catalog, a Root Category must be created for each website.  Thus, if there are 3 websites, there will be 3 Root Categories with subcategories under them.)
2: Store Configuration in the Magento Admin
1. Now that we have created our Categories, it’s time to create our websites by going to System -> Manage Stores and clicking the “Create Website” button.
    Name – domain name of our new website
    Code – a parameter that will be used in configuring the Apache web server to point to that particular domain name
2. Once the website has been created, we’ll create the store corresponding to this website by clicking on the “Create Store” button in System -> Manage Stores.
    Website – website to which this store will be associated
    Name – the same as the website name
    Root Category – the root category that will be used for this store. (Refer to Step 1 for Details)
3. Then, we create the store view which is the interface that the customer will be able to access on the frontend.  Click the “Create Store View” button in System -> Manage Stores.
    Store – store to which this view will be associated
    Name – name of this store view (i.e. English Version, German Version, etc.)
    Code – code for this store view
    Status – if enabled, this store view will be accessible from our frontend, otherwise, it will not be accessible
4. After the Store has been created, we need to configure the Unsecure Base URL and Secure Base URL under System -> Configuration -> General -> Web.  Before we set their respective base URLs, we first need to ensure that the configuration scope is set to the domain1.com website to define which site we are working on.
Then, we modify the base URLs for both Unsecure:
and Secure:
with the corresponding domain name by unchecking the ”Use default [STORE VIEW]” checkbox and then save the configuration.
5. Now we just repeat Steps 2-4 for the other two websites, domain2.com and domain3.com by replacing the fields with their respective information.
3: Store Configuration in the Server
(B)  Two Way of Store Configuration :- Choose as Like You .
First Way :-
1: Store Configuration in the Server Side.
1. Now we re-configure the Apache configuration file, httpd.conf, for all domains to set the DocumentRoot to our Magento directory.  In this case, the directory is /var/www/http

    ServerAdmin webmaster@domain1.com
    DocumentRoot /var/www/http
    ServerName domain0.com

    ServerAdmin webmaster@domain2.com
    DocumentRoot /var/www/http
    ServerName domain1.com

    ServerAdmin webmaster@domain3.com
    DocumentRoot /var/www/http
    ServerName domai2.com
2. Edit the .htaccess file at /var/www/http/.htaccess and add the following lines below:
SetEnvIf Host www\.domain1\.com MAGE_RUN_CODE=domain1_com
SetEnvIf Host www\.domain1\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain1\.com MAGE_RUN_CODE=domain1_com
SetEnvIf Host ^domain1\.com MAGE_RUN_TYPE=website
SetEnvIf Host www\.domain2\.com MAGE_RUN_CODE=domain2_com
SetEnvIf Host www\.domain2\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain2\.com MAGE_RUN_CODE=domain2_com
SetEnvIf Host ^domain2\.com MAGE_RUN_TYPE=website
SetEnvIf Host www\.domain3\.com MAGE_RUN_CODE=domain3_com
SetEnvIf Host www\.domain3\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain3\.com MAGE_RUN_CODE=domain3_com
SetEnvIf Host ^domain3\.com MAGE_RUN_TYPE=website
3. Restart Apache Server
If you are on a Red Hat based distribution, you’ll be able to type service apache restart.  For other distributions, you’ll want to type apachectl restart.  (***NOTE: The second option here is different than “apachectl graceful” which will run a graceful restart and reload configuration files, without terminating current connections.  We don’t have any visitors to our site yet, so it’s okay to do a “apachectl restart”.)
4: We’re Ready to Go!
After we’ve complete all of these steps we should now see all 3 domains in our backend:
All that’s left now is to add products to the catalog and give each site a custom theme if we wish to do so.  Many people are taking advantage of Magento’s powerful multi-store functionality, whether it’s to set up stores with multiple languages, different catalogs and even the same catalogs (as in our example) with different front ends as a marketing vehicle.  No matter which you decide to use Magento’s powerful features for, we hope this post will provide a good starting point to help you get there!
Second Way :-
1: Web-Site &Store Configuration in the Index.php .
Complete Create  Root category And Website, store, store view then process  again. Open index.php in magento  Root Folder some changes Doc file according.
First,  Find this line code and replace.
Find  = $mageFilename = MAGENTO_ROOT . ‘/app/Mage.php’;
Replace = $mageFilename = MAGENTO_ROOT . ‘../app/Mage.php’;
Second ,  Find this line code and replace.
Find  =  Mage::run($mageRunCode, $mageRunType);
Replace  =
$i=$_SERVER['REQUEST_URI'];
switch ($i):
    case ‘www.domain1.com’:
         Mage::run(“domain1″,”website”);
        break;
    case ‘www.domain2.com’:
         Mage::run(“domain2″,”website”);
        break;
    case ‘www.domain3.com’:
         Mage::run(“domain3″,”website”);
        break;
    default:
       Mage::run(“default”,”website”);
endswitch;
After Completed two major change save index.php file in root folder. Delete all cache and Re-indexing admin panel. After restart apache server. Then check our Multi-domain website is ready for running.
Magento’s provide  powerful multi-store functionality . I hope this instruction  will provide a good starting point to help you get there!
End .