This file contains hidden or 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_action( 'save_post', 'bp_generate_pdf', 10, 2 ); | |
public function bp_generate_pdf( $post_id, $post ) { | |
// check autosave and permissions. | |
$should_generate_pdf = $_POST['generatepdf'] ?? 0; | |
if ( $should_generate_pdf ) { |
This file contains hidden or 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
# Maybe | |
#sudo xcode-select -s /Applications/Xcode.app/Contents/Developer | |
sudo npm install --global --unsafe-perm ios-deploy |
This file contains hidden or 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
# Regex by Jonathan Stassen. http://blog.jstassen.com/2016/03/code-regex-for-instagram-username-and-hashtags | |
/(?:@)([A-Za-z0-9_](?:(?:[A-Za-z0-9_]|(?:\.(?!\.))){0,28}(?:[A-Za-z0-9_]))?)/g |
This file contains hidden or 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: bPlus User per site | |
*/ | |
// Url to redirect | |
define( 'BP_DEFAULT_URL', 'http://superpositif.com/interne/'); | |
function is_valid_user_login( $user = null ) { | |
// Current site |
This file contains hidden or 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 | |
// You need Vimeo API https://github.com/vimeo/vimeo.php | |
require 'path-to-your-lib/vimeo/vimeo.php'; | |
// Get this from your account | |
$vimeo_client_id = 'xxxxx'; | |
$vimeo_client_secret = 'xxxxxxxxxxx'; | |
// This has to be generated on your site, plugin or theme | |
$vimeo_token = 'xxxxxx'; |
This file contains hidden or 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 get_post_by_custom_field($args) | |
{ | |
$defaults = array( | |
'post_type' => 'post', | |
'key' => '', | |
'value' => '', | |
'compare' => '=' | |
); |
This file contains hidden or 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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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 | |
$uname = ''; | |
$user =& JFactory::getUser(); | |
if ( is_object($user) ) { | |
$uname = $user->name; | |
} | |
?> | |
<!-- Piwik --> | |
<script type="text/javascript"> |
This file contains hidden or 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 | |
// Load WordPress | |
require_once('../../../../wp-load.php'); | |
$this_form_spam = trim($_POST['this_title']); | |
if ( empty($this_form_spam) ) { | |
// Get values from form | |
$name = $_POST['name']; | |
$phone = $_POST['phone']; |
This file contains hidden or 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
# Update WordPress home and url | |
UPDATE wp_options SET option_value = replace(option_value, 'beta.mydoamin.com', 'mydomain.com') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
# Update URL's of every entry (post, page, custom post type) | |
UPDATE wp_posts SET guid = replace(guid, 'beta.mydomain.com', 'mydomain.com'); | |
# Update post content | |
UPDATE wp_posts SET post_content = replace(post_content, 'beta.mydomain.com', 'mydomain.com'); | |
# Update menus |
NewerOlder