Skip to content

Instantly share code, notes, and snippets.

View abegit's full-sized avatar

UnsceneBTS abegit

View GitHub Profile
@abegit
abegit / yoast_seo_opengraph_change_image_size.php
Created July 1, 2020 21:58 — forked from amboutwe/yoast_seo_opengraph_change_image_size.php
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/
*/
@abegit
abegit / pmpro_ld2aff.php
Created April 9, 2020 03:09 — forked from strangerstudios/pmpro_ld2aff.php
Link Paid Memberships Pro discount codes to affiliate accounts from another plugin/service.
/*
Link discount codes to affiliates.
*/
//this is the parameter we're looking for to find affiliates... based on which plugin/etc you are using
define('PMPRO_LDC2AFF_KEY', 'wpam_id'); //Affiliates Manager Plugin
//define('PMPRO_LDC2AFF_KEY', 'pa'); //WordPress Lightweight Affiliates
//define('PMPRO_LDC2AFF_KEY', 'ref'); //AffiliateWP
//helper function to get the values from options and make sure they are an array
function pmpro_ld2aff_getOptions() {
@abegit
abegit / Convert Custom Taxonomy to Custom Post Type
Created December 2, 2019 07:29 — forked from Strap1/Convert Custom Taxonomy to Custom Post Type
A very hacky and quick way to transfer a Custom Taxonomy to Custom Post Type and transfer associated metadata to Custom Meta Fields. Note: You can use this if it fits your needs, but it is custom to my set up. Use in a testing environment. It's a plugin with no interface, runs on activation and depending on the amount of data, may hit PHP timeou…
<?php
/*
Plugin Name: Convert Custom Taxonomy to Custom Post Type
Plugin URI: N/A
Description: A plugin to convert a Custom Taxonomy to a Custom Post Type and transfer associated metadata.
Version: 0.1
Author: Strap1
Author URI: http:/www.hiphopinenglish.com
/** Convert Taxonomy '%name%' to CPT '%name%' **/
@abegit
abegit / wc_order_status_changes.php
Created February 2, 2016 20:11
WooCommerce Hooks for Order Status Changes
function mysite_pending($order_id) {
error_log("$order_id set to PENDING", 0);
}
function mysite_failed($order_id) {
error_log("$order_id set to FAILED", 0);
}
function mysite_hold($order_id) {
error_log("$order_id set to ON HOLD", 0);
}
function mysite_processing($order_id) {
@abegit
abegit / widget-latest-ads.php
Last active January 18, 2016 12:06
Remove image if no image provided (disable placeholder image) in Another Wordpress Classifieds Plugin 3.3.4
<?php
class AWPCP_LatestAdsWidget extends WP_Widget {
public function __construct($id=null, $name=null, $description=null) {
$id = is_null($id) ? 'awpcp-latest-ads': $id;
$name = is_null($name) ? __('AWPCP Latest Ads', 'AWPCP') : $name;
$description = is_null($description) ? __('Displays a list of latest Ads', 'AWPCP') : $description;
parent::__construct($id, $name, array('description' => $description));
}
add_filter( 'the_content', 'post_love_display', 99 );
function post_love_display( $content ) {
$love_text = '';
if ( is_single() ) {
$love = get_post_meta( get_the_ID(), 'post_love', true );
$love = ( empty( $love ) ) ? 0 : $love;
$love_text = '<p class="love-received"><a class="love-button" href="#" data-id="' . get_the_ID() . '">give love</a><span id="love-count">' . $love . '</span></p>';