<?php include_once($_SERVER[“DOCUMENT_ROOT”] . base_path() . path_to_theme() . “/nav.php”); ?>
Author Archives: Anoop Saini
Condition for Login Logout
<?php if (user_is_logged_in()): ?> <p>Hello, logged in user</p>
<?php else:?> <p>Hello, stranger</p>
<?php endif;?>
Call Static image in theme
<img src=”<?php print base_path() . path_to_theme(); ?>/images/banner-side-1.jpg” alt=””>
Condition for home page
<?php if (drupal_is_front_page()){
echo ‘this is home’;
} ?>
Conditional Tags Test
<?php $conditions = array( 'is_home()', 'is_front_page()', '$wp_query->is_posts_page', 'is_page()', 'is_single()', 'is_singular()', 'is_attachment()', 'is_search()', 'is_archive()', 'is_category()', 'is_tag()', 'is_tax()', 'is_author()', 'is_day()', 'is_month()', 'is_year()', 'is_time()', 'is_date()', 'is_paged()', 'is_comments_popup()', 'is_preview()', 'is_404()', ); echo '<h2>Conditional Tag</h2><ul>'; $i = 0; foreach ( $conditions as $condition ) : $condition = str_replace('()', '', $conditions[$i]); switch ( $condition ) : case 'is_front_page' : $query = is_front_page(); break; case '$wp_query->is_posts_page' : $query = $wp_query->is_posts_page; break; default : $query = $wp_query->$condition; break; endswitch; echo '<li><code>' . $conditions[$i] . '</code>'; echo $query ? ': <span style="color:green">true</span>' : ': <span style="color:red">false</span>'; echo '</li>'; $i++; endforeach; echo '</ul>'; ?>
An image make center form every side
.Absolute-Center {
margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; }
.parent_div{position: relative; height:200px; width:200px;}
Implement CSS on All common classes
[class*=”col-“] {}
Display woo commerce Reviews on any other Place
woocommerce_template_product_review() {
woocommerce_get_template( ‘single-product/tabs/tabs.php’ );
}
add_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_product_review’, 20 );