Skip to content

Instantly share code, notes, and snippets.

View stefanRepac's full-sized avatar
Fast forward

Stefan Repac stefanRepac

Fast forward
  • Novi Sad, Serbia
View GitHub Profile
@tripflex
tripflex / functions.php
Created March 2, 2021 00:10
Custom taxonomy sort order args for WP Job Manager Search and Filtering
<?php
add_filter( 'search_and_filtering_get_taxonomy_data_options_args', 'smyles_sf_custom_tax_ordering' );
function smyles_sf_custom_tax_ordering( $args ) {
$args['orderby'] = 'term_id';
return $args;
}
@woogists
woogists / wc-auto-add-product-to-cart.php
Last active March 22, 2023 15:31
Automatically add product to cart on visit
/**
* Automatically add product to cart on visit
*/
add_action( 'template_redirect', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
$product_id = 64; //replace with your own product id
$found = false;
//check if product already in cart
if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
@donchenko
donchenko / functions.php
Created November 9, 2016 11:51
Wordpress custom Walker for Bootstraping menu and wp_list_pages
// Add custom walker to functions.php
class BS_Page_Walker extends Walker_Page {
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class='dropdown-menu' role='menu'>\n";
}
public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
@jdsteinbach
jdsteinbach / .gitignore
Last active May 20, 2019 13:52
Sass+PostCSS
node_modules
@ghalusa
ghalusa / youtube_id_regex.php
Created June 20, 2015 23:14
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@chrisblackwell
chrisblackwell / wordpress-nginx.conf
Created April 22, 2015 12:02
WordPress nginx confuration
server {
listen 80 default_server;
server_name domain.tld;
access_log /srv/www/domain.tld/logs/access.log;
error_log /srv/www/domain.tld/logs/error.log;
root /srv/www/domain.tld/public;
index index.php index.html index.htm;
client_max_body_size 20M;
/*
* Lazy Load for Youtube
* by Kevin Weber
*/
var $lly = jQuery.noConflict();
$lly(document).ready(function() {
function doload_lly() {
@wpexplorer
wpexplorer / wordpress-remove-post-type-slug
Last active October 7, 2022 01:27
Remove Custom Post Type Slug
<?php
/**
* Remove the slug from published post permalinks for our custom post types.
*/
add_filter( 'post_type_link', function( $post_link, $post, $leavename ) {
$post_types = array(
'post_type_1',
'post_type_2'
);
@bartholomej
bartholomej / css-media-queries-cheat-sheet.css
Last active October 8, 2024 08:59
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }