Skip to content

Instantly share code, notes, and snippets.

Avatar

David Perez davidperezgar

View GitHub Profile
@davidperezgar
davidperezgar / updatemeta.php
Created Jul 6, 2021
Updates meta and adds text to taxonomy
View updatemeta.php
<?php
define('WP_USE_THEMES', false);
require_once('wp-load.php');
echo 'iniciado proceso.<br />';
/**
* Finds product categories ids from array of names given
*
@davidperezgar
davidperezgar / generatepress-comments-hook.php
Created Apr 7, 2020
GeneratePress | Add Comments in custom post type
View generatepress-comments-hook.php
/**
Appearance > Elements > Add new Hook
Hook: after_content
Execute PHP: active
Display rules: All singular of CPT
From: https://generatepress.com/forums/topic/applying-blog-archive-and-single-post-settings-to-custom-type-post/#post-903150
**/
<span class="comments-link">
<?php comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); ?>
</span>
@davidperezgar
davidperezgar / clean-node-modules.sh
Created Aug 3, 2019
Clean Node modules folders
View clean-node-modules.sh
find . -name "node_modules" -exec rm -rf '{}' +
@davidperezgar
davidperezgar / htaccess.txt
Created May 30, 2019
Redirect all domain to new and keep url path
View htaccess.txt
<IfModule mod_rewrite.c>
RewriteEngine On
redirectMatch 301 ^(.*)$ https://www.domain.com$1
</IfModule>
@davidperezgar
davidperezgar / wpcli-updates.sh
Created Apr 23, 2019
WordPress rutine SH to update all Local WordPress
View wpcli-updates.sh
#!/bin/bash
#
#
clear
for d in * ; do
#if [ -e "$d/wp-config.php" ]; then
cd "$d"
echo "-----------------------------"
echo "Updating WordPress in... $d"
wp core update
View script-fb-track.js
<script>fbq('track', 'Lead');</script>
@davidperezgar
davidperezgar / wc-update-weight.php
Created Apr 16, 2019
WooCommerce rutine for update weights products
View wc-update-weight.php
<?php
ini_set( 'memory_limit', '1024M' );
ini_set( 'max_execution_time', 600 );
define( 'WP_USE_THEMES', false );
require_once 'wp-load.php';
echo 'iniciado proceso.' . date( 'H:i:s', time() ) . '<br />';
$weight_final = '1000';
@davidperezgar
davidperezgar / script-fb-pageview.js
Created Apr 9, 2019
Facebook Script Page View for Google Tag Manager
View script-fb-pageview.js
<script>fbq('track', 'PageView');</script>
@davidperezgar
davidperezgar / gist-orders.sh
Created Apr 5, 2019
Site ground Installation for Git
View gist-orders.sh
ssh-keyscan -t rsa itm20.siteground.biz >> ~/.ssh/known_hosts
cd ~/.ssh/
nano [your-private-key]
chmod 600 [your-private-key]
ssh-add -K ~/.ssh/[your-private-key]
# Poner la frase privada que da SG-Git
git clone ssh://[url]
@davidperezgar
davidperezgar / .gitignore
Created Mar 10, 2019
Gitignore recommended for WordPress Site repository
View .gitignore
#Wordpress
htaccess.txt
index.php
licencia.txt
license.txt
readme.html
robots.txt
wp-activate.php
wp-blog-header.php
wp-comments-post.php