Skip to content

Instantly share code, notes, and snippets.

@mohandere
mohandere / yoast-seo-sitemap.php
Last active December 21, 2024 14:03
Wordpress yoast seo plugin, generate custom sitemap for custom URLS
<?php
/**
* Create a new custom yoast seo sitemap
*/
add_filter( 'wpseo_sitemap_index', 'ex_add_sitemap_custom_items' );
add_action( 'init', 'init_wpseo_do_sitemap_actions' );
// Add custom index
@joashp
joashp / PushNotifications.php
Last active February 19, 2025 06:09
Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification
<?php
// Server file
class PushNotifications {
// (Android)API access key from Google API's Console.
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI';
// (iOS) Private key's passphrase.
private static $passphrase = 'joashp';
// (Windows Phone 8) The name of our push channel.
private static $channelName = "joashp";
@scotcrop
scotcrop / custom-woocommerce-order-status.php
Last active May 8, 2019 05:10
Adding and updating a custom shop order post status when upgrading WooCommerce 2.1 and below to 2.2 and up
<?php
/*
Plugin Name: Custom Order Status for WooCommerce Shop Orders
Plugin URI: http://scotcrop.com/2014/10/11/adding-and-updating-a-custom-shop-order-post-status-when-upgrading-woocommerce-2-1-and-below-to-2-2-and-up/
Description: Creates a new WooCommerce Order Status called In-Production and updates shop orders that were converted to a post status of 'publish' after upgrading from WooCommerce 2.1 and earlier to 2.2 and later.
Version: 1.0
Author: Scott Cropper
Author URI: http://scotcrop.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
<?php
/**
* Plugin Name: Author Meta Box only with authors
* Plugin URI: http://wordpress.stackexchange.com/questions/60429/stop-loading-collaborators-users-on-add-new-post-or-page
* Description:
* Author: Frank Bueltge
* Author URI: http://bueltge.de
* License: GPLv3
*/
add_action( 'admin_menu', 'fb_remove_author_meta_boxes' );
anonymous
anonymous / config.json
Created September 30, 2015 14:27
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
<?
// <readme>
/*
This is a lite version of Olark's and Intercom's functionality (without the chat part).
It lets you get feedback from users on your site to your email.
And you won't have to rely on another company anymore!
#killyourdependencies
@amboutwe
amboutwe / yoast_seo_opengraph_change_image_size.php
Last active October 28, 2024 06:15
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 19 2020 using Yoast SEO 14.1 on WordPress 5.4.1
* Accepts WordPress reserved image size names: 'thumb', 'thumbnail', 'medium', 'large', 'post-thumbnail'
* Accepts custom image size names: https://developer.wordpress.org/reference/functions/add_image_size/
*/
@lukecav
lukecav / DNS Prefetch domains
Last active October 9, 2024 00:30
WP Rocket - Advanced Options Prefetch DNS requests examples
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
@riodw
riodw / deploy.php
Last active May 8, 2023 08:54
Deploy to Production Server with git using PHP
<?php
/**
* GIT DEPLOYMENT SCRIPT
*
*/
// The commands
$commands = array(
'echo $PWD',
'whoami',
'git reset --hard HEAD',
@mahdiyazdani
mahdiyazdani / get-dynamic-sidebar.php
Created February 1, 2018 13:12
Since there is NO "get_dynamic_sidebar" in the core, to return sidebar content instead of echoing out use the method below.
<?php
/**
* Gets the sidebar content based on given sidebar ID.
*
* @link https://forums.envato.com/t/get-dynamic-sidebar/76169/3?u=mypreview
* @param string $id ID of required registered sidebar.
* @return string|html The content of sidebar returned with HTML markup without "echo".
*/
if ( ! function_exists( 'prefix_get_dynamic_sidebar' ) ) :