Skip to content

Instantly share code, notes, and snippets.

<?php
add_action( 'init', 'my_theme_custom_post' );
function my_theme_custom_post() {
register_post_type( 'agent',
array(
'labels' => array(
'name' => __( 'Agents' ),
function header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
woocommerce_cart_link();
$fragments['a.cart-button'] = ob_get_clean();
return $fragments;
function woocommerce_cart_link() {
global $woocommerce;
?>
<a href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?>" title="<?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> <?php _e('in your shopping cart', 'woothemes'); ?>" class="cart-button ">
<span class="label"><?php esc_html_e('My Basket:', 'woothemes'); ?></span>
<?php echo esc_html($woocommerce->cart->get_cart_total()); ?>
<span class="items"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count); ?></span>
</a>
<?php
}
<?php
function stock_styled_map_shortcode($atts, $content = null) {
extract( shortcode_atts( array(
'lat' => '40.7433379',
'lng' => '-74.0103219',
'title' => 'Head Office',
'desc' => 'House 21, Grand St.<br/> New York, USA',
.shopping-icon {
border: 1px solid #ddd;
border-radius: 50%;
color: #1b80bb;
font-size: 18px;
height: 53px;
line-height: 50px;
position: absolute;
right: 0;
text-align: center;
<div class="header-area">
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="logo">
<h2><a href="index.html">Stock</a></h2>
</div>
</div>
<div class="col-md-9">
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
function educare_logo_carousel_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'logos' => '',
'count' => '6',
'tablet_count' => '4',
@raselahmed7
raselahmed7 / google-fonts.php
Last active November 11, 2022 10:22
How to call google fonts from theme option in best way
<?php
$frozen_body_font_get = cs_get_option('frozen_body_font');
$frozen_heading_font_get = cs_get_option('frozen_headding_font');
function frozen_crazycafe_body_gf_url() {
$font_url = '';
$frozen_body_font_get = cs_get_option('frozen_body_font');
if(array_key_exists('family', $frozen_body_font_get)) {
$frozen_body_font_get_family = $frozen_body_font_get['family'];
jQuery(document).ready(function($){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {
// mobile code here
}
});
@raselahmed7
raselahmed7 / custom-post-loop-with-pagination-shortcode.php
Last active September 7, 2022 16:23
Custom post loop with pagination in shortcode
<?php
function portfolios_shortcode($atts){
extract( shortcode_atts( array(
'expand' => '',
), $atts) );
global $paged;
$posts_per_page = 6;
$settings = array(