Monday, 9 February 2015

Get post between dates in wordpress




$args = array(
'posts_per_page'   => -1,
'order'            => 'DESC',
'post_type'        => 'post',
'post_status'      => 'publish',
'cat'          => 59,
'date_query'  => array(
array(
'after'     => array(
'year'    => 2015,
'month'   => 02,
'day' => 06,
'hour' => 10,
'minute'  => 28,
'second'  => 55,
),
'before'    => array(
'year'    => 2015,
'month'   => 02,
'day' => 09,
'hour' => 15,
'minute'  => 24,
'second'  => 01,
),
),
),
);

$query_result = new WP_Query($args);


User can access only own media in wordpress




add_filter( 'ajax_query_attachments_args', 'show_users_own_attachments', 1, 1 );

function show_users_own_attachments($query){
  $id = get_current_user_id();
  if( !current_user_can('manage_options') )
  $query['author'] = $id;
  return $query;
}

Wednesday, 28 January 2015

Facebook & instagram Went Down on 27 Jan 2015 for an one hour.

Facebook blames technical hitch after social media sites including Instagram and Tinder go down for an hour... but hackers claim THEY were responsible.




  • Millions locked out of Facebook and Instagram for around an hour
  • Hackers from the online group Lizard Squad have claimed responsibility 
  • Mark Zuckerberg's social media sites have denied it was a cyber attack 
  • Blamed the outage on 'a change that affected our configuration systems'
  • AIM, Tinder and MySpace were also claimed to have been offline    
  • Lizard Squad hit Malaysia Airlines, Sony and Xbox in past month

Friday, 19 December 2014

Plugin 'federated' is disabled. xampp

I have find solution for this error in xampp

1) On start MySQL service we have face some problem



2) Solution for this Error Plugin 'FEDERATED' is disabled.
     Just open Task Manager and go in Details tab then find mysqld.exe file stop this task.


3) Let's Re-try  start MySQL Service and see it's working.


Sunday, 9 November 2014

Shift click select multiple items like gmail

Shift click select multiple items like gmail. you can change any types of elements like check , div, a, label, any html tags.




Multiple selected view

Selected thumb id

Saturday, 13 September 2014

How do I keep two divs that are side by side the same height

Step 1 Css

    <style type="text/css">

     html{ height:100%;}

     body{ position:absolute; width:100%; height:100%; padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; font-size:15px; color:#333;}

     .wp{ width:1000px; margin:0 auto; height:100%;}

     .left_part{ background:#eee; color:#333; text-align:center; height:100%; float:left; width:300px;}

     .right_part{ background:#ccc; color:#333; text-align:center; height:100%; float:left; width:700px;}

    </style>


Step 2 Html

<body>
    <div class="wp">
       <div class="left_part"> Left Div <br/> Padding top and bottom not allowd </div>
       <div class="right_part"> Right Div <br/> Padding top and bottom not allowd  </div>
    </div>
 </body>
    

Friday, 5 September 2014

Magento get category tree view

Output View


Step 1 Goto theme/layout/catalog.xml put this code in file


    <reference name="left">
    <block type="catalog/navigation" name="category_list_sidebar" template="catalog/navigation/categorymenu.phtml"/>
    </reference>

Step 2 Goto theme/template/catalog/ thane create navigation folder and put categorymenu.phtml file inside.


<?php
    $_helper = Mage::helper('catalog/category');
    $_categories = $_helper->getStoreCategories();
    $currentCategory = Mage::registry('current_category');
    ?>
    <div class="block block-list block-categorys">
        <div class="block-title">
       <strong><span>Category</span></strong>
        </div>
    <div class="block-content">
        <ul class="category_sub">
    <?php if (count($_categories) > 0){ ?>
    
                    <?php
    global $index;
    global $data;
   
    foreach($_categories as $_category){
    
    $check_child_class = check_child_par($_category->getId());
    $collaps = ($check_child_class)? "<span class='show-cat'>+</span>" : "";
    echo "<li class='".$check_child_class."'>";
    echo "<a href='".$_helper->getCategoryUrl($_category)."'>".$_category->getName();
    echo " (".product_count($_category->getId()).")";
    echo "</a>".$collaps;
    echo check_child($_category->getId());
    echo "</li>";
   
    }
    }
    function check_child($cid){
    $_helper = Mage::helper('catalog/category');
    $_subcategory = Mage::getModel('catalog/category')->load($cid);
    $_subsubcategories = $_subcategory->getChildrenCategories();
   
    if (count($_subsubcategories) > 0){
    echo "<ul>";
    foreach($_subsubcategories as $_subcate){
   
    $check_child_class = check_child_par($_subcate->getId());
    $collaps = ($check_child_class)? "<span class='show-cat'>+</span>" : "";
   
    echo "<li class='".$check_child_class."'>";
    echo "<a href='".$_helper->getCategoryUrl($_subcate)."'>".$_subcate->getName();
    echo " (".product_count($_subcate->getId()).")";
    echo "</a>".$collaps;
    echo check_child($_subcate->getId());
    echo "</li>";
    }
    echo "</ul>";
    }else{
    return "";
    }
    }
   
   
    function check_child_par($cid){
   
    $_subcat = Mage::getModel('catalog/category')->load($cid);
    $_subsubcats = $_subcat->getChildrenCategories();
   
    if (count($_subsubcats) > 0){
    return "parent";
    }else{
    return "";
    }
    }
   
    function product_count($cid){
    $products_count = Mage::getModel('catalog/category')->load($cid)->getProductCount();
    return $products_count;
    }
    ?>
    </ul>
    </div>
    </div>