How to show popular posts in wordpress

Wordpress
Here I want to tech you how to get popular posts based on that post comment in wordpress withaout plugin. Display popular posts without plugin in wordpress | Get popular posts without plugin in wordpress To show lists of the popular posts in wordpress is very usefull features for getting post popularity wise or SEO to increase visitor or provide better output to the user. Many plugins are available to get popular posts in wordpress but here I want to show you how to get popular posts in wordpress without plugins. Opent function.php file and put it below code into them. [php] # Displays a list of popular posts <?php function dp_popular_posts($num, $pre='<li>', $suf='</li>', $excerpt=false) { global $wpdb; $querystr = "SELECT $wpdb->posts.post_title, $wpdb->posts.ID, $wpdb->posts.post_content FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish'…
Read More

How I can get theme URL in wordpress

Wordpress
I want to get my wordpress theme URL to display image.Below is the code to get wordpress current theme URL. This function will return the theme directory URL so you can use it in other functions: [sourcecode language="plain"] get_bloginfo('template_directory'); [/sourcecode] Alternatively, this function will echo the theme directory URL to the browser: [sourcecode language="plain"] bloginfo('template_directory'); [/sourcecode] So an example for an image in the themes images/headers folder would be: [sourcecode language="plain"] <img src="<?php bloginfo('template_directory'); ?>/images/headers/image.jpg" /> [/sourcecode] [JWD-Wordpress-Development]
Read More

Please check for sufficient write file permissions in magento connect manager

Magento
If you want to use install any other magento extension or upgrade your mangeto from magento connect manager its really very easy to do that. You can find really some great extensions some are paid and some are free from magento commerce site.Find extension that interest you, click "Get extension key", agree with license agreement and get key. But some times you want use magento connect manager and its display error like "Please check for sufficient write file permissions". Magento Connect requires write permissions to the Magento files in order to install new extensions or upgrade the software to a new version. You can change your file/folder permissions either thru your FTP Client (like FileZilla) OR thru a SSH client (like Putty). Go inside your Magento folder & change permissions…
Read More

How to get Magento layout outside of Magento

Magento
Get Magento Content Outiside of Magento I integreated wordpress in my magento store and I will try to get magento data in wordpress file. I want to same header in my both site magento and wordpress. I tryed to hard and finally got the solution to get any magento layout in wordpress. Below are the script to get magento layout outside of magento. [php] <?php require_once '/home/.../public_html/.../app/Mage.php'; umask(0); /* not Mage::run(); */ Mage::app('default'); // get layout object $layout = Mage::getSingleton('core/layout'); //get block object $block = $layout->createBlock('page/template_links'); /* choose whatever category ID you want */ //$block->setCategoryId(3); $block->setTemplate('page/template/links.phtml'); echo $block->renderView(); ?> [/php] Get Magento layout outside of Magento Below script to get whole magento header section with top links out side of magento. [php] <?php require_once '/home/.../public_html/.../app/Mage.php'; umask(0); /* not Mage::run(); */…
Read More

How to submit form without refreshing page with jquery and ajax

JQuery
This is very simple artical for submit HTML form data without refreshing page with the help of JQuery and Ajax. jQuery provides a rich set of methods for AJAX web development. With jQuery AJAX, you can request TXT, HTML, XML or JSON data from a remote server using both HTTP Get and HTTP Post. $.ajax(options) is the syntax of the low level AJAX function. $.ajax offers more functionality than higher level functions like load, get, and post. The option parameter takes name|value pairs defining url data, passwords, data types, filters, character sets, timeout and error functions. Below is code for HTML form. [sourcecode language="plain"] <form method="post" name="form"> <ul> <li><input id="name" name="name" type="text" /></li> <li><input id="username" name="username" type="text" /></li> <li><input id="password" name="password" type="password" /></li> <li> <select id="gender" name="gender"> <option value="">Gender</option> <option…
Read More

Display sub categories on main category page+Magento

Magento
display sub-categories instead of products on main category page+magento If you want to display Sub Categories list on main category or parent category in magento. So this artical may be help ful to you for design and display subcategories on parent category page+magento. => Copy the Category.php file from core to local. Create any directories required under app/code/local. (This is so images can be displayed) [sourcecode language="plain"] $ cp app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php app/code/local/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php [/sourcecode] => Add -addAttrbuteToSelect('image') to getChildrenCategories function [sourcecode language="plain"] public function getChildrenCategories($category) { $collection = $category->getCollection(); /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */ $collection->addAttributeToSelect('url_key') ->addAttributeToSelect('name') ->addAttributeToSelect('image') ->addAttributeToSelect('all_children') ->addAttributeToSelect('is_anchor') ->addAttributeToFilter('is_active', 1) ->addIdFilter($category->getChildren()) ->setOrder('position', 'ASC') ->joinUrlRewrite() ->load(); return $collection; } [/sourcecode] => Add or modify the category view template app/design/frontend/yourdiractory_path/default/template/catalog/category/view.phtml [php] <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id); $rootcat = $_category->entity_id; $cat =…
Read More

Execute PHP code in .html file

PHP
Only way to execute PHP code on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html file [sourcecode language="plain"]AddType application/x-httpd-php .html[/sourcecode] Or for .htm file [sourcecode language="plain"]AddType application/x-httpd-php .htm[/sourcecode] If you only plan on including the PHP on one page, it is better to setup this way: [sourcecode language="plain"] <Files yourpage.html> AddType application/x-httpd-php .html </Files> [/sourcecode] This code will only make the PHP executable on the yourpage.html file, and not on all of your html pages. [JWD-Web-Development]
Read More

How to install magento on local server

Magento
Magento Installation | Magento Installation Process | Magento Installation On Localserver Step 1: Open php.ini file for apache C:/xampp/apache/bin/php.in Find php_curl.dll and remove comment(;) From the following line [sourcecode language="plain"]extension=php_curl.dll[/sourcecode] Same way make changes in C:/xampp/php/php.ini file Restart apache server from xampp control panel Step 2: If database connection error occurs "InnoDB Engine" Open file xampp\mysql\bin\my.cnf (Drag and Drop that file to Notepad or notepad++ program) Find code: [sourcecode language="plain"] # Comment the following if you are using InnoDB tables skip-innodb #innodb_data_home_dir = "/xampplite/mysql/" #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = "/xampplite/mysql/" #innodb_log_arch_dir = "/xampplite/mysql/" ## You can set .._buffer_pool_size up to 50 - 80 % ## of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M ## Set .._log_file_size to 25 % of buffer pool…
Read More

Check youtube video is still valid

PHP
Check youtube video is still valid using youtube's API Manytimes youtube user can decide to delete their video. So I would like to periodically run a script to check that the youtube video is still valid or not. Also, you can fine best video review apps for shopify and make better your Shopify theme. Suppose your Youtube url is : http://www.youtube.com/v/jc0rnCBCX2c So here your Youtube video Id is jc0rnCBCX2c $vid [video Id] posible format/sintax: 1. http://www.youtube.com/watch?v=[ID]&feature=…&… 2. http://www.youtube.com/watch?v=[ID] 3. www.youtube.com/watch?v=[ID] 4. youtube.com/watch?v=[ID] 5. http ://www.youtube.com/v/[ID] 6. www.youtube.com/v/[ID] 7. youtube.com/v/[ID] 8. [ID] 9. …. and any valid youtube video url [php]&amp;amp;lt;?php function checkYoutubeId($id) { if (!$data = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$id)) return false; if ($data == "Video not found") return false; return true; } ?&amp;amp;gt; [/php] http://gdata.youtube.com/feeds/api/videos/jc0rnCBCX2c if it does not exist then you…
Read More

How to call static block in magento

Magento
What is static block in magento? Static blocks can be used throughout your theme wherever you want to make small updates to a section of a page. Typical uses would be for promotional banners/callouts in sidebars or for some custom text in the middle of your home page. Static blocks can also be inserted into CMS pages or included in category pages. Creating s static block => Login in into your magento admin panel. => Navigate to CMS->Static blocks => Click Add new block => Give your block title (Title: A descriptive name to identify this block) => Give your block identifier (Identifier: The identifer will allow you to call this block from your template files or using the Magento markup tags. Typically this would be programmer friendly name with…
Read More