Skip to content

Instantly share code, notes, and snippets.

View Tmeister's full-sized avatar
🇲🇽
Working from home

Enrique Chavez Tmeister

🇲🇽
Working from home
View GitHub Profile
@Tmeister
Tmeister / CF7 Form
Last active April 20, 2019 04:46
Contact Form 7 - User Profile
<label> Your Name (required)
[text* your-name] </label>
<label> Your Email (required)
[email* your-email] </label>
<label> Your Phone (required)
[tel* your-phone] </label>
<label> Subject
@Tmeister
Tmeister / wp-config.php
Created July 13, 2017 15:29
Set the WP setting to the current server host
<?php
define('SP_REQUEST_URL', ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', SP_REQUEST_URL);
define('WP_HOME', SP_REQUEST_URL);
@Tmeister
Tmeister / .htaccess
Last active October 5, 2017 20:16
Cache
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset UTF-8
# Force UTF-8 for a number of file formats
<IfModule mod_mime.c>
AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
</IfModule>
# FileETag None is not enough for every server.
<IfModule mod_headers.c>
Header unset ETag
@Tmeister
Tmeister / functions.php
Last active April 4, 2017 21:04
Change the Maximum per_page value in the Query
<?php
function change_end_points_default_values($endpoints){
/**
* Posts EndPoint
* print_r($endpoints['/wp/v2/posts']);
*
* Argumentos Originales
*
* Array
@Tmeister
Tmeister / elementor-custom-templates.php
Created April 1, 2017 18:28
You can show *your* page templates in the predesigned templates area with screenshots
<?php
/**
* Elementor get the local templates via a CPT query and use a filter to let us change the template data
* https://github.com/pojome/elementor/blob/master/includes/template-library/sources/local.php#L202
* In ouy theme or plugin we can hook that filter as follow
*
* This filter change the source only for the *page* template type to show it in the main tab
* @see https://cl.ly/1z2Y1n2x0K0F
**/
<?php
protected function _register_controls() {
/**
* Start a control section.
*/
$this->start_controls_section(
'section-ine-tabs',
[ 'label' => __( 'INE Tabs', 'sage' ), ]
);
@Tmeister
Tmeister / .htaccess
Last active March 20, 2019 20:51
301 redirections to force naked domain with SSL
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www.)?domain.com$ [NC]
RewriteRule . http://domain.com%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^(www.)?domain.com$ [NC]
RewriteRule . https://domain.com%{REQUEST_URI} [R=301,L]
@Tmeister
Tmeister / function.php
Created March 8, 2017 19:28
Thrive Content Editor - Add nofollow to external links
<?php
function add_nofollow( $content ) {
$re = '/<a(.*)>/iU';
preg_match_all( $re, $content, $matches );
$domain = get_bloginfo( 'url' );
foreach ( $matches[0] as $link ) {
if ( strpos( $link, $domain ) === false ) {
if ( strpos( $link, 'nofollow' ) === false ) {
$new_link = str_replace( '>', ' rel="nofollow">', $link );
<?php
/*
Plugin Name: WordPress.org Plugin
Plugin URI: https://developer.wordpress.org/plugins/the-basics/
Description: Basic WordPress Plugin Header Comment
Version: 20160911
Author: WordPress.org
Author URI: https://developer.wordpress.org/
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
{
"version": 1.0,
"name": "podcast",
"primary_color": "",
"accent_color": "#0000ff",
"text_color": "",
"showFeedback": true,
"header": {
"header_img": "",
"title": "Understanding Active Problems",