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' ),
@humayunahmed8
humayunahmed8 / google-maps-shortcode.php
Created September 14, 2018 15:36
Google Maps shortcode
<?php
function stock_styled_map_shortcode($atts, $content = null) {
extract( shortcode_atts( array(
'lat' => '40.7433379',
'lng' => '-74.0103219',
'title' => esc_html('Head Office', 'stock-toolkit'),
'desc' => esc_html('House 21, Grand St. New York, USA', 'stock-toolkit'),
'height' => '500',
), $atts) );
@humayunahmed8
humayunahmed8 / project-topic.txt
Last active October 3, 2022 05:29
Project Topic
## table of contents:
=====================
1. Basic Php
2. Install WordPress in live server
2.1. WordPress Dashboard Introduction
3. Introduce about IDE & WordPress template hierarchy
4. Introducing about Visual Composer
4.1. Visual Composer academy site
4.2. Use Visual Composer Element/Addons
@nahid
nahid / method-overlap.php
Last active January 25, 2017 21:20
This gist is for PHP traits Example
<?php
trait Greetings
{
public function sayHello()
{
return 'Hello Bro';
}
public function goodBye()
@lukecav
lukecav / add-to-cart.php
Created July 31, 2016 02:57
Display Product Variations in the Shop Loop
<?php
/**
* Loop Add to Cart
*
* This template can be overridden by copying it to yourtheme/woocommerce/loop/add-to-cart.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@rajeebbanstola
rajeebbanstola / get-woocommerce-categories.php
Created December 28, 2015 11:15
Simple way to fetch WooCommerce Categories with Image and Description
<?php
$get_featured_cats = array(
'taxonomy' => 'product_cat',
'orderby' => 'name',
'hide_empty' => '0',
'include' => $cat_array
);
$all_categories = get_categories( $get_featured_cats );
$j = 1;
@hemusyl
hemusyl / bootstraptab.php
Last active November 24, 2015 18:57
Tab Dynamic (Bootsrap tab)
http://wordpress.stackexchange.com/questions/192451/dynamic-bootstrap-tabs-with-post-title-doesnt-display-the-content?lq=1
<div id="tab">
<ul class="nav nav-tabs" role="tablist">
<?php $loop = new WP_Query( array( 'post_type' => 'candidates', 'posts_per_page' => -1 ) ); ?>
<?php
$counter = 0;
while ( $loop->have_posts() ) : $loop->the_post();
$counter++;
?>
<li role="presentation" class="post-<?php the_ID(); ?> <?=($counter == 1) ? 'active' : ''?>"><a href="#post-<?php the_ID(); ?>" aria-controls="home" role="tab" data-toggle="tab"><?php the_title();?></a></li>
@bekarice
bekarice / wc-add-images-order-email-table.php
Created May 26, 2015 21:08
Add images to WooCommerce emails
// Edit order items table template defaults
function sww_add_wc_order_email_images( $table, $order ) {
ob_start();
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
wc_get_template( $template, array(
'order' => $order,
'items' => $order->get_items(),
'show_download_links' => $show_download_links,
@mrbobbybryant
mrbobbybryant / gist:e28efc0d84afbead7d0e
Last active June 8, 2017 09:17
WordPress Custom Post Type (Simple)
<?php
function dwwp_register_post_type() {
$args = array('public'=> true, 'label'=> 'Staff');
register_post_type( 'staff', $args);
}
add_action( 'init', 'dwwp_register_post_type' );
@freelancingcare
freelancingcare / wordpress-code-example.php
Last active June 5, 2020 08:40
Wordpress Code Referance From Practical Use
Root url for website
---------------------------------------------------------
<?php site_url(); ?>
<?php bloginfo('url'); ?>
title of specific post/page
---------------------------------------------------------
<?php wp_title(); ?>
Title of site