Skip to content

Instantly share code, notes, and snippets.

View asadaly111's full-sized avatar
🏠
Working from home

Asad Ali asadaly111

🏠
Working from home
View GitHub Profile
<?php $my_query = new WP_Query('page_id=13');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>
@jonelvinnaorbe
jonelvinnaorbe / gist:e38bf4b4e577f04e5750
Last active August 30, 2018 12:18
Wordpress Themetation
<?php echo get_option('home'); ?> <!-- get the home URL -->
<?php bloginfo('description'); ?> <!-- display the blog description -->
<?php bloginfo('name'); ?> <!-- display the blog name -->
<?php bloginfo('template_directory') ?> <!-- get the home URL for template's directory -->
<?php echo get_template_directory_uri(); ?>
<?php wp_list_pages('sort_order=desc&title_li='); ?> <!-- display the page list in descending order withour title -->
<?php wp_list_pages('sort_order=desc&depth=1&title_li='); ?> <!-- display the page list in descending order with "current_page_item" class
<?php wp_list_bookmarks(); ?> <!-- display the list of blogrolls -->
<?php echo date('Y'); ?>
@corsonr
corsonr / gist:6182904
Last active April 9, 2022 15:38
WooCommerce - Add custom fee to cart
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Add custom fee to cart automatically
*
*/
function woo_add_cart_fee() {
@aleksblago
aleksblago / Date-Select-Markup.html
Last active September 3, 2023 04:04
Markup: Select options for Month, Day, and Year.
<span>
<select name="month">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
@zetareticoli
zetareticoli / Animated scroll
Created June 16, 2012 11:48
Animated scroll to anchor/id function with jQuery
function goToByScroll(id){
$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
<a href="#linkID" onclick="goToByScroll('linkID')">Link</a>
@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@sydlawrence
sydlawrence / much better way for ajax urls
Created December 2, 2010 10:03
using history pushState
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title>window.history.pushState Example</title>
</head>
<body>
<h1>window.history.pushState Example</h1>