This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This file contains code to create a Video CPT, and a "Download" button in the admin header. | |
* When clicking that download button, it creates a Video post with all the meta data saved as `simian_data`. | |
* | |
* Requires a site options field for `simian_api_key` that is the API key from Simian. | |
* Eg: This must work: get_field("simian_api_key", "option"); | |
* | |
* Also need an option field for `simian_api_url` that is something like `https://clientNameHere.gosimian.com/api/simian/get_media` | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Bookmarklet to download all IG images for the current account page. | |
* Use https://katanya.co.uk/labs/bookmarklet-generator to generate the bookmarklet. | |
* | |
* SEE: https://www.instagram.com/web/search/topsearch/?query=casetify | |
* SEE: https://www.instagram.com/graphql/query/?query_id=17888483320059182&variables={"id":"6662673","first":50,after:"QVFEaEJRR0tiTXpVUVV5ZVlfQktDUFJYNUpRWlhOMktKbWZXWEh4cHNCSFV2ZDA5RVBaUzFfWmxVOWlaMHNfVU1wNTQ1dFVXZlVoT05oUzRVVHYyNVBZMQ=="} | |
*/ | |
(async function () { | |
let userId = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Redirect from the Shopify site (except for any account or cart pages) | |
switch(true) { | |
case document.location.href.includes('/cart') : | |
case document.location.href.includes('/account') : | |
break; | |
default: | |
window.top.location.href = 'https://shop.example.com/'; | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Extend WP-GraphQL to allow users/authors to be public. Useful to query all posts by Author. | |
*/ | |
function enable_authors_public( $is_private, $model_name, $data, $visibility, $owner, $current_user ) { | |
// Allow Users to be considered publicly queryable | |
if ( 'UserObject' === $model_name ) { | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Use this script as a starting point to convert old WP meta fields to ACF meta fields. | |
* Add ?convert_meta to the URL and load any page in backend. | |
* You should edit the script, and only run it once. | |
*/ | |
function custom_convert_meta_to_acf() | |
{ | |
// Abort if no query param in URL | |
if(! isset($_GET["convert_meta"])) { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query MockApi { | |
home: page(id: "/featured", idType: URI) { | |
id | |
title | |
excerpt | |
content | |
uri | |
featuredImage { | |
node { | |
...MediaImage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Setup Custom Post Types | |
*/ | |
function create_custom_posts() { | |
// Create a loop of all the post types we need | |
$types = array( | |
[ | |
'name' => 'US Region', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add a custom taxonomy my for "Work Filter" certain post types | |
*/ | |
function setup_work_filters() { | |
$labels = array( | |
'name' => 'Work filter', | |
'singular_name' => 'Work filter', | |
'search_items' => 'Search filters', | |
'popular_items' => 'Popular filters', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Register custom API endpoints | |
* | |
* NOTE: Will be accessable at: https://example.com/wp-json/fuxt/v1/search?term=Netflix&engine=work | |
*/ | |
function add_fuxt_api_routes() | |
{ | |
// Sitemap | |
register_rest_route("fuxt/v1", "/search", [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Region Select Custom Post Type | |
*/ | |
function cutandrun2016_post_type() { | |
// US editors | |
$us_post_labels = array( | |
'name' => _x('US Region', ''), | |
'singular_name' => _x('US Region', ''), | |
'add_new' => _x('Add New', 'editor'), |
NewerOlder