Skip to content

Instantly share code, notes, and snippets.

View ashtonlance's full-sized avatar

Ashton Lance ashtonlance

View GitHub Profile
@ashtonlance
ashtonlance / functions.php
Created March 10, 2022 16:56
Get Elementor custom css
<?php
add_action( 'graphql_register_types', function() {
register_graphql_field( 'Page', 'customCSS', [
'type' => 'String',
'description' => __( 'Custom CSS from Editor', 'wp-graphql' ),
'resolve' => function() {
// call your function which return your custom css
return $this->addPageCustomCssToGraphql();
}
] );
@ashtonlance
ashtonlance / functions.php
Created March 10, 2022 16:55 — forked from mlipscombe/functions.php
Render Elementor-styled content in WP-GraphQL
add_action('graphql_register_types', function() {
$post_types = WPGraphQL::$allowed_post_types;
if (!empty($post_types) && is_array($post_types)) {
foreach($post_types as $post_type) {
$post_type_object = get_post_type_object($post_type);
register_graphql_field($post_type_object->graphql_single_name, 'styledContent', [
'type' => 'String',
'description' => __('The styled elementor content of the page', 'cottontailpress-headless'),
'resolve' => function($post) {
$content = '';
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
@ashtonlance
ashtonlance / Custom Twitter embed styles
Created February 15, 2018 18:02
Custom Twitter embed styles
# HTML
<a class="twitter-timeline"
data-width="100%"
data-height=""
data-tweet-limit="3"
data-dnt="true"
data-chrome="noheader nofooter noborders noscrollbar transparent"
data-theme="dark"
data-link-color="#ffffff"
href="https://twitter.com/TheSeam">Tweets by TheSeam</a>
@ashtonlance
ashtonlance / letsencrypt.md
Created December 18, 2017 20:13
Installing Let's Encrypt with Cerbot on DigitalOcean & ServerPilot

Let's Encrypt

SSH as root into the server

ssh root@SERVER_IP_ADDRESS

Install Certbot

wget https://dl.eff.org/certbot-auto