Skip to main content

Get Google Calendar Event List in WordPress

<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function  get_calender_events() { $params = array(); /*Get current date*/ $current_date  = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key =  "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...

Show all category view

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category    design
* @package     base_default
* @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
* @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*/
?>
<?php
/**
* Category view template
*
* @see Mage_Catalog_Block_Category_View
*/
?>


<?php
$_helper    = $this->helper('catalog/output');
$_category  = $this->getCurrentCategory();
$_imgHtml   = '';
if ($_imgUrl = $_category->getImageUrl()) {
$_imgHtml = '<div class="category-image"><img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" /></div>';
//$_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
}
?>
<?php
echo $slide=Mage::getModel('catalog/category')->load($_category->getId())->getData('attribute_code');


?>
<?php $_imageUrl=$this->getCurrentCategory()->getThumbnailImageUrl(); ?>

<?php if($_imgUrl): ?>
<?php echo $_imgHtml ?>
<?php endif; ?>

<?php /*?><div class="page-menu">
        <div class="container"><?php */?>
        <?php
           
            //get the current category
            $_cat = new Mage_Catalog_Block_Navigation();
            $currentCat = $_cat->getCurrentCategory();
       
            //get the children of the current category
            $subCats = Mage::getModel('catalog/category')->load($currentCat->getId())->getChildren();
       
            //get sub category ids
            $subCatIds = explode(',',$subCats);
        ?>
       
            <?php /*?><ul>
            <?php foreach($subCatIds as $subCatId): ?>
                <?php
                    $subCat = Mage::getModel('catalog/category')->load($subCatId);
                    $_img = $subCat->getImageUrl();
                ?>
                   
                <li>
                    <a href="<?php echo $subCat->getUrl();?>"><?php echo $subCat->getName();?></a>
                </li>
            <?php endforeach; ?>
            </ul>
            <div class="cls"></div>
        </div>
</div> <?php */?>
 

<?php
$level = $this->getCurrentCategory()->getParentCategory()->getLevel();  
if($level > 1){                
$idss = $this->getCurrentCategory()->getParentCategory()->getId();
          if(isset($_SESSION['ids']))
        {
            $ids=$_SESSION['ids'];
         }
        else
        {
            $_SESSION['ids']=$idss;
                   
        }                          
    }
    else{
    //echo $this->escapeHtml($_category->getName());
$ids = $this->escapeHtml($_category->getId());
//echo $ids;
$refine = 'refine';
 $_SESSION['ids']=$ids;
    }
?>

<div class="page-menu">
        <div class="container">
  <ul>
         
 <?php
$cat = Mage::getModel('catalog/category')->load($ids);
$subcats = $cat->getChildren();

foreach(explode(',',$subcats) as $subCatid)
{
  $_category = Mage::getModel('catalog/category')->load($subCatid);
  if($_category->getIsActive()) {
    echo '<li><a href="'.$_category->getURL().'" title="View the products for the "'.$_category->getName().'" category">'.$_category->getName().'</a>';
    $sub_cat = Mage::getModel('catalog/category')->load($_category->getId());
    $sub_subcats = $sub_cat->getChildren();
    echo "<ul>";
    foreach(explode(',',$sub_subcats) as $sub_subCatid)
    {
          $_sub_category = Mage::getModel('catalog/category')->load($sub_subCatid);
         
          if($_sub_category->getIsActive()) {
              echo '<li class="sub_cat"><a href="'.$_sub_category->getURL().'" title="View the products for the "'.$_sub_category->getName().'" category">'.$_sub_category->getName().'</a></li>';
              $sub_sub_cat = Mage::getModel('catalog/category')->load($sub_subCatid);
              $sub_sub_subcats = $sub_sub_cat->getChildren();
              foreach(explode(',',$sub_sub_subcats) as $sub_sub_subCatid)
              {
                $_sub_sub_category = Mage::getModel('catalog/category')->load($sub_sub_subCatid);
                if($_sub_sub_category->getIsActive()) {
                    echo '<li class="sub_cat"><a href="'.$_sub_sub_category->getURL().'" title="View the products for the "'.$_sub_sub_category->getName().'" category">'.$_sub_sub_category->getName().'</a></li>';
                }
              }
           }
       
     }
       echo "</ul>";
     echo '</li>';
  }
}

?>
               
               
               
               
 
  </ul>
  </div>
    </div>

   
<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml(); ?>

<div class="page-title category-title">
<?php if($this->IsRssCatalogEnable() && $this->IsTopCategory()): ?>
<a href="<?php echo $this->getRssLink() ?>" class="link-rss"><?php echo $this->__('Subscribe to RSS Feed') ?></a>
<?php endif; ?>
<h1><?php //echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?><?php echo $_category->getName(); ?></h1>
</div>

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description std">
<?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
</div>
<?php endif; ?>

<div class="home-category">
<div class="container">
<ul class="product-grid">
<?php $i=1;?>
<?php foreach($subCatIds as $subCatId): ?>
<?php
$subCat = Mage::getModel('catalog/category')->load($subCatId);
//$_img = $subCat->getImageUrl();
$image = $subCat->getThumbnail();
                    $_img = Mage::getBaseUrl('media').'catalog/category/'.$image;

?>
<?php if($subCat->getIsActive()):
$hidepro = 'hidepro';
if($i == 4)
{
$last = 'last';
$i = 0;
}
?>
<li class="list_sub <?=$last?>">
<?php //display category image
if($subCat->getImageUrl()): ?>
<?php /*?><img src="<?php echo $subCat->getImageUrl(); ?>" /> <?php */?>
<?php endif; ?>

<?php /*?><img src="<?php echo $_img?>" alt="<?=$cat->getName()?>" title="<?=$cat->getName()?>" height="220px;" width="220px;" /><?php */?>

<h2 class="cat-name"><?php echo $subCat->getName();?></h2>
<a class="cat-img" href="<?php echo $subCat->getUrl();?>">
<img alt="" src="<?php echo $_img?>">
</a>
</li>
<?php endif; ?>
 
<?php $i++; $last = ''; ?>
<?php endforeach; ?>
</ul>
</div>
</div>

<?php if($hidepro) { ?>
   <script>
    jQuery(document).ready(function(){
jQuery(".footer-container").addClass( "footer-align" );
});  

</script>
<style type="text/css">
#adj-nav-container, .adj-nav{ display:none !important; }
.category-products{ display:none !important; }
.listsubcat{ display:block !important; }
</style>
 
<?php } ?>

    <?php if($refine != 'refine')
echo $this->getLayout()->createBlock('cms/block')->setBlockId('layered-nav')->toHtml();
?>
   
<?php if($this->isContentMode()): ?>
<?php echo $this->getCmsBlockHtml() ?>

<?php elseif($this->isMixedMode()): ?>
<?php echo $this->getCmsBlockHtml() ?>
<?php echo $this->getProductListHtml() ?>

<?php else: ?>
<?php echo $this->getProductListHtml() ?>
<?php endif; ?>

<script src="<?php echo $this->getSkinUrl('js/jquery.accordion.2.0.js'); ?>" type="text/javascript"></script>
<script type="text/javascript">
jQuery.noConflict()
jQuery(document).ready(function() {
jQuery('#navigate').accordion({  
canToggle: true
  });
});  
jQuery(".loading").removeClass("loading");
</script>

Comments

Popular posts from this blog

Create Signature pad with save on database in php

Create Signature pad with save on database in php 1.create a folder images index.php ============   <!DOCTYPE >     <head>     <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />     <title>Signature Pad</title>     <script type="text/javascript" src="jquery-1.8.0.min.js"></script>     <script type="text/javascript"> $(document).ready(function () {     /** Set Canvas Size **/     var canvasWidth = 400;     var canvasHeight = 100;     /** IE SUPPORT **/     var canvasDiv = document.getElementById('signaturePad');     canvas = document.createElement('canvas');     canvas.setAttribute('width', canvasWidth);     canvas.setAttribute('height', canvasHeight);     canvas.setAttribute('id', 'canvas');     canvasDiv.appendChild(canvas);    ...

Get Google Calendar Event List in WordPress

<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function  get_calender_events() { $params = array(); /*Get current date*/ $current_date  = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key =  "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...

WooCommerce Mini cart With Ajax

WooCommerce Mini cart //MINI CART SECTION   <div class="productdiv rightcart">                                                         <?php if ( ! WC()->cart->is_empty() ) : ?>     <ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>">         <?php             do_action( 'woocommerce_before_mini_cart_contents' );             foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {                 $_product     = apply_filters( 'woocommerce_cart_item_pro...