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 | |
// Embed gist without JavaScript in WordPress | |
wp_embed_register_handler( 'gist', '/https?:\/\/gist\.github\.com\/([a-z0-9\/]+)([\?\#]file[=-].*)?/i', 'qr_embed_gist' ); | |
function qr_embed_gist( $matches, $attr, $url, $rawattr ) { | |
if(empty($matches[1])){$matches[1]=null;} | |
if(empty($matches[2])){$matches[2]=null;} // Query single file | |
$file = wp_remote_get( esc_url_raw( 'https://gist.github.com/' . esc_attr($matches[1]) . '.json' ) ); | |
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 | |
$img_url = 'http://someurl.com/image.jpg'; | |
if ( !empty( $img_url ) ) { | |
$tmp_file = download_url( $img_url, 10 ); | |
if ( !is_wp_error( $tmp_file ) ) { | |
$size = getimagesize( $tmp_file ); | |
$img_width = $size[0]; | |
$img_height = $size[1]; |
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( 'genesis_before_sidebar_widget_area', 'qr_remove_default_sidebar' ); | |
function qr_remove_default_sidebar() { | |
if ( get_post_type() == 'my-cpt' ) { // set CPT here | |
remove_action( 'genesis_sidebar', 'ss_do_sidebar' ); | |
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); | |
add_action( 'genesis_sidebar', 'qr_add_cpt_sidebar' ); | |
} | |
} | |
function qr_add_cpt_sidebar() { |
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 | |
$args = array( 'hide_empty=0' ); | |
$terms = get_terms( 'my-taxonomy', $args ); | |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { | |
$count = count( $terms ); | |
$i = 0; | |
$term_list = '<p class="term-list">Tags: '; | |
foreach ( $terms as $term ) { | |
$i++; | |
$term_list .= '<a href="' . esc_url( get_term_link( $term ) ) . '" alt="' . esc_attr( sprintf( __( 'View all post filed under - %s -', 'my_localization_domain' ), $term->name ) ) . '">' . $term->name . '</a>'; |
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
add_action( 'pre_get_posts', 'qr_exclude_tagged_posts' ); | |
function qr_exclude_tagged_posts( $query ) { | |
if ( $query->is_main_query() && $query->is_home() ) { | |
$query->set( 'tag__not_in', array( 63 ) ); | |
} | |
} |
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
$urlcontent = qr_loadUrl( 'http://myurl.com' ); | |
function qr_loadUrl( $url ) { | |
if(is_callable( 'curl_init' )) { | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
$data = curl_exec($ch); | |
curl_close($ch); |
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 | |
/** | |
* Genesis Framework | |
* Multilingual archive sitemap template (page_archive.php) | |
**/ | |
//* Template Name: Archive | |
// Remove standard post content output | |
remove_action( 'genesis_post_content', 'genesis_do_post_content' ); |
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
<!DOCTYPE html> | |
<html lang="es-MX"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Tituo de la pagina</title> | |
<meta name="description" content="Agregar descripcion"> | |
<style type="text/css"> <!--Fix width, height and margin --> | |
img { | |
width: 600px; | |
height: 340px; |
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
#!/bin/bash | |
#================================================================ | |
# Let's Encrypt renewal script for Nginx on Ubuntu | |
# Modified by Cristhian Martinez Ochoa <[email protected]> https://qrokes.com | |
# Original author Erika Heidi <[email protected]> | |
# Usage: sudo le-renew [base-domain-name] | |
#================================================================ | |
# Modify le_path with your current ubuntu username | |
domain=$1 | |
le_path='/home/user/letsencrypt' |
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
server { | |
listen 80; | |
listen [::]:80; | |
server_name example.com www.example.com subsite.com www.subsite.com another.com www.another.com; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; |