Skip to content

Instantly share code, notes, and snippets.

View B1-0S's full-sized avatar

Dimitar Radev B1-0S

View GitHub Profile
@bebaps
bebaps / load-more.js
Created February 21, 2017 14:54
AJAX load more button using the WP REST API
// This function implements a "Load More" button.
// It assumes that there is already a matching query that has executed on the page, so this AJAX call is just a continuation of that query to grab additional posts.
// There are no animations added here. For a smoother experience, it is a good idea to add animations to the button (ex. a loading icon during the request), or making the new posts animate in (ex, using Animate.css to fade them into the page)
$(function() {
// Grab the load more button, since I only want to run the code if the button is on the page
var loadMoreButton = $('#load-more');
if (loadMoreButton) {
// Because there are already posts on the page, we need to manually tell this query what page of results to grab so that is doesn't load duplicate posts
var loadPosts = function(page) {
@raewrites
raewrites / twenty-sixteen-theme-definition
Created June 29, 2016 07:54
Twenty Sixteen Theme Definition
/*
Theme Name: Twenty Sixteen
Theme URI: https://wordpress.org/themes/twentysixteen/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Twenty Sixteen is a modernized take on an ever-popular WordPress layout — the horizontal masthead with an optional right sidebar that works perfectly for blogs and websites. It has custom color options with beautiful default color schemes, a harmonious fluid grid using a mobile-first approach, and impeccable polish in every detail. Twenty Sixteen will make your WordPress look beautiful everywhere.
Version: 1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, blue, gray, red, white, yellow, dark, light, one-column, two-columns, right-sidebar, fixed-layout, responsive-layout, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, flexible-header, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, tran
@jlengstorf
jlengstorf / README.md
Created October 8, 2014 20:28
Adds responsive embedding to WordPress oEmbed content.

Responsive Embeds in WordPress

This snippet filters oEmbed output in WordPress (the_content()) to force responsive embeds.

Usage

To use, add the contents of responseive_embeds.less to your site's stylesheet (if you're not using LESS, don't forget to move the iframe,object,embed rule outside of .embed-container and change it to .embed-container iframe,.embed-container object,.embed-container embed).

Then add the responsive_embed() function to your theme's functions.php and insert the add_filter() call in your theme's setup function.

@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@roykho
roykho / gist:9292693
Last active December 5, 2023 13:59
WooCommerce: How to remove star review rating under the product title when enable review is off.
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 'my_woocommerce_template_single_rating', 10 );
function my_woocommerce_template_single_rating() {
global $product;
if ( $product->post->comment_status === 'open' )
wc_get_template( 'single-product/rating.php' );
@retlehs
retlehs / gist:4120053
Created November 20, 2012 18:45
Remove unnecessary markup from WooCommerce
<?php
/**
* Remove unnecessary markup from WooCommerce:
*
* 1. Remove <meta name="generator" content="WooCommerce (version)" />
* 2. Remove the addition of <body class="theme-themename">
*/
function woocommerce_head_cleanup() {
global $woocommerce;