Pages

Wednesday, March 30, 2016

Fonts Grabber from your web fonts file

Here is the link from where we can get the fonts grabbed in all the version of the browsers and is working.
Simply Upload your Font file and download the code and use in your site made easy.

https://www.fontsquirrel.com/tools/webfont-generator

Internet Downlaod Manager 6.21 Working Version with Crack

Internet Downlaod Manager 6.21 Working Version with Crack
I have checked and tested in Windows 10 Pro

http://www.4shared.com/get/UFeb2BvWce/idm1Fcfd.html

Wednesday, March 16, 2016

Full Pagination In Wordpress Function

<?php 
function pagination($pages = '', $range = 4)
{

     $showitems = ($range * 2)+1;  

     global $paged;

     if(empty($paged)) $paged = 1;
     if($pages == '')

     {

         global $wp_query;

         $pages = $wp_query->max_num_pages;

         if(!$pages)

         {

             $pages = 1;

         }

     }   



     if(1 != $pages)

     {

         echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>";

         if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";

         if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Previous</a>";



         for ($i=1; $i <= $pages; $i++)

         {

             if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))

             {

                 echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";

             }

         }
         if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next &rsaquo;</a>";

         if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last &raquo;</a>";

         echo "</div>\n";

     }

}
?>


<?php if (function_exists("pagination")) {

pagination($additional_loop->max_num_pages);

} ?>

Friday, March 4, 2016

Upload Image in PHP and Create Directory if not Available directory in the Path

define('UPLOAD_PATH_CAT', SITE_URL.'/yourPath');

if(isset($_FILES['categoryImg']['name']) && !empty($_FILES['categoryImg']['name'])):

if (!file_exists(UPLOAD_PATH_CAT)):  
   mkdir(UPLOAD_PATH_CAT, 0777, true);
$content = "No Direct Access!";
$fp = fopen(UPLOAD_PATH_CAT."/index.html","wb");
fwrite($fp,$content);
endif;
$fileParts = explode(".",$_FILES['categoryImg']['name']);
$ext = end($fileParts);
unset($fileParts[count($fileParts)-1]);  // extension removed from file name;
/**  File Name without extension  **/
$fName = implode(".",$fileParts)."_".strtotime(date('Y-m-d H:i:s'));
/**  File Name With Extension  **/
$fName =  preg_replace("/[!@#$%^&*()-+|{}\s]/","_",$fName);
$fileName = str_replace(" ","_",$fName.".".$ext);
move_uploaded_file($_FILES['categoryImg']['tmp_name'],
UPLOAD_PATH_CAT.$fileName);
$data['categoryImg']=$fileName;

if(isset($editPageId) && $editPageId!=''):
$bData=$this->common_model->getData($editPageId,'category','categoryId');
$unlinkUrl=UPLOAD_PATH_CAT."{$bData->categoryImg}";
if(file_exists($unlinkUrl)):
unlink($unlinkUrl);
endif;
endif;
endif;

Thursday, March 3, 2016

Get Posts of taxonomy Who has no child catgories and the posts has children categories

$catId = $_GET['brandID'];
    $termChildren = get_term_children($catId, 'carproducer');
    //print_r($termChildren);
    if(count($termChildren) > 0 ){
            $args = array(
                'posts_per_page'   => 1,
                'orderby'          => 'date',
                'order'            => 'ASC',
                'post_type'        => 'car',
                'post_status'      => 'publish',
                'tax_query' => array(
                    array(
                        'taxonomy' => 'carproducer',
                        'field' => 'term_id',
                        'terms' => $catId
                    ),
                    array(
                        'taxonomy' => 'carproducer',
                        'field' => 'id',
                        'terms' => $termChildren,
                        'operator' => 'NOT IN'
                    )
                )
             
            );
        }else{
            $args = array(
                'posts_per_page'   => 1,
                'orderby'          => 'date',
                'order'            => 'ASC',
                'post_type'        => 'car',
                'post_status'      => 'publish',
                'tax_query' => array(
                    array(
                        'taxonomy' => 'carproducer',
                        'field' => 'term_id',
                        'terms' => $catId
                    )
                )
             
            );

        }
 $posts_array = get_posts( $args );