Skip to content

Instantly share code, notes, and snippets.

View Archie22is's full-sized avatar
💭
I may be slow to respond.

ᴀʀᴄʜɪᴇ ᴍᴀᴋᴜᴡᴀ™ Archie22is

💭
I may be slow to respond.
View GitHub Profile
@Archie22is
Archie22is / function.php
Created August 6, 2019 09:00
Send a notification or ping in WordPress when a post is created
<?php
/**
* @param int $post_id The ID of the post.
* @param WP_Post $post The post object.
* @param bool $update True if the post already exists and is being updated
*/
function wpse_post_ping( $post_id, $post, $update ) {
if ( $post->post_status === 'publish' ) { // Only fire when published
wp_remote_post(
@celticwebdesign
celticwebdesign / SlickSlider-dots-custom-pagination.js
Last active July 18, 2019 08:56
SlickSlider with dots navigation and custom pagination
// see SeaGrass
if ($(".slideshow-full-container").length > 0) {
// https://github.com/kenwheeler/slick/issues/1403#issuecomment-282066130
// Test for slide length, if one, hide navigation dots
// the event needs to be run before slick is initialized
$('.slideshow-full-container').on('init', function (event, slick, direction) {
// console.log($('#full_page_slideshow .slick-slide').length);
@stracker-phil
stracker-phil / popups-for-divi-full-config.php
Last active July 10, 2019 16:15
Popups for Divi: Example with all WordPress configuration options
<?php
add_filter( 'evr_divi_popup-js_data', 'my_divi_popup_options' );
function my_divi_popup_options( $config ) {
// -- Modify UI of popups --
/**
* The base z-index. This z-index is used for the overlay, every
* popup has a z-index increased by 1:
@laurenclark
laurenclark / index.html
Created June 25, 2018 21:51
Pure CSS Social Media Icons
<div class="footer-social-icons">
<h4 class="_14">Follow us on</h4>
<ul class="social-icons">
<li><a href="" class="social-icon"> <i class="fa fa-facebook"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-twitter"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-rss"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-youtube"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-linkedin"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-google-plus"></i></a></li>
</ul>
<?php
if(!function_exists('wc_get_products')) {
return;
}
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$ordering = WC()->query->get_catalog_ordering_args();
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby']));
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby'];
@NickDeckerDevs
NickDeckerDevs / hubdbapi.php
Last active December 9, 2019 09:20
Two attempts at endpoints using oauth2 token
function upload_table($table_id, $csv_file_name) {
$accessToken = $_SESSION['accessToken'];
// /hubdb/api/v1/tables/:tableId/import
$url = "https://api.hubapi.com/hubdb/api/v1/tables/$table_id/import";
$postBody = [
"file" => "@$csv_file_name;type=text/csv",
"config" => [
"resetTable" => true,
"skipRows" => 1,
"format" => 'csv',
@sudipbd
sudipbd / functions.php
Created November 19, 2016 08:22
WordPress numeric pagination
<?php
function ct_paging_nav() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
@johnbillion
johnbillion / wp_mail.md
Last active January 27, 2024 14:06
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

@butlerblog
butlerblog / auto-login-from-reg-email.php
Last active November 5, 2021 15:44
WordPress auto login from native registration email
<?php
/*
This code snippet can be added to your functions.php file (without the <?php)
to add a query string to the login link emailed to the user upon registration
which when clicked will validate the user, log them in, and direct them to
the home page.
*/
/**
* This first function is hooked to the 'user_register' action which fires
@jeremyrwross
jeremyrwross / functions.php
Created March 13, 2015 20:39
Wordpress 301 redirect using functions.php
add_action('template_redirect','my_template_redirect');
function my_template_redirect() {
$redirect_to = false;
list($url_path,$params) = explode('?',$_SERVER['REQUEST_URI']);
$path_parts = explode('/',trim($url_path,'/'));
switch ($path_parts[0]) {
case 'wrongpage1.html':
$redirect_to = '/';
break;
case 'wrongpage2.php':