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 | |
/** | |
* Create media from path. | |
* | |
* @param string $file_path | |
*/ | |
function create_media_from_path( $file_path, $post_id = 0 ) { | |
// Requires | |
require_once( ABSPATH . 'wp-admin/includes/admin.php' ); | |
require_once( ABSPATH . 'wp-admin/includes/image.php' ); |
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
fetch(ajax_url, { | |
method: 'POST', | |
credentials: 'same-origin', | |
headers: new Headers({'Content-Type': 'application/x-www-form-urlencoded'}), | |
body: 'action=zget_profile_user' | |
}) | |
.then((resp) => resp.json()) | |
.then(function(data) { | |
if(data.status == "success"){ | |
_this.setState({loaded:true,user:data.user}); |
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 | |
/* | |
Plugin Name: Install Commands | |
Plugin URI: | |
Description: Copy command to install plugins trough WP-CLI or Composer. | |
Author: Allyson Souza | |
Version: 1.0 | |
Author URI: https://hastedesign.com.br | |
Text Domain: install-commands | |
Domain Path: /languages |
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
import React from "react"; | |
import "./_about.scss"; | |
import { FormattedMessage, useIntl } from "gatsby-plugin-intl" | |
import AboutEN from "./about.en.mdx" | |
import AboutPT from "./about.pt.mdx" | |
import AboutES from "./about.es.mdx" | |
export default function Header() { | |
const intl = useIntl() |
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
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="cmder" /> | |
<package id="nodejs" /> | |
<package id="git" /> | |
<package id="composer" /> | |
<package id="sourcetree" /> | |
<package id="slack" /> | |
<package id="gifcam" /> | |
<package id="paint.net" /> |
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 | |
/** | |
* Automatically sets the post thumbnail. | |
* | |
* Use: | |
* add_action( 'the_post', 'haste_starter_autoset_featured' ); | |
* add_action( 'save_post', 'haste_starter_autoset_featured' ); | |
* add_action( 'draft_to_publish', 'haste_starter_autoset_featured' ); | |
* add_action( 'new_to_publish', 'haste_starter_autoset_featured' ); | |
* add_action( 'pending_to_publish', 'haste_starter_autoset_featured' ); |
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
## Output posts into post.txt file, only ID | |
wp post list --post_type=shop_order --field=ID --format=table > posts.txt | |
## Loop trough each post ID stored in posts.txt then run some wp-cli command, like post meta update | |
## Change the two %p for %%p if you want to run it in a .bat file (I run it directly on cmd) | |
FOR /F "tokens=1* delims=" %p IN (posts.txt) DO wp post meta update %p my_meta_key "My Value" |
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
:: Name: haste status | |
:: Purpose: move Haste WordPress projects from folders | |
:: Author: @allysonsouza | |
:: URL: https://github.com/allysonsouza | |
:: Version: 0.0.1 | |
:: License: GPL-v2 | |
@ECHO OFF | |
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION |
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 | |
include 'wp-config.php'; | |
include 'wp-admin/includes/export.php'; | |
ob_start(); | |
export_wp(); | |
$file = ob_get_contents(); | |
ob_end_clean(); | |
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 | |
function my_custom_post_type() { | |
register_post_type('labs', [ | |
'label' => 'Labs', | |
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('<svg width="20" height="20" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path fill="black" d="M1591 1448q56 89 21.5 152.5t-140.5 63.5h-1152q-106 0-140.5-63.5t21.5-152.5l503-793v-399h-64q-26 0-45-19t-19-45 19-45 45-19h512q26 0 45 19t19 45-19 45-45 19h-64v399zm-779-725l-272 429h712l-272-429-20-31v-436h-128v436z"/></svg>') | |
]); | |
} | |
add_action( 'init', 'my_custom_post_type' ); |