Skip to content

Instantly share code, notes, and snippets.

View josecarlospsh's full-sized avatar
💻
Working from home

Jose Carlos Pajuelo josecarlospsh

💻
Working from home
View GitHub Profile
{
"basics": {
"name": "Jose Carlos Pajuelo Sh.",
"picture": "https://jcpsh.xyz/img/jcpsh.jpg",
"label": "Web Developer",
"headline": "",
"summary": "",
"website": "https://jcpsh.xyz",
"projects_url": "https://jcpsh.xyz/projects",
"username": "josecarlospsh",
@josecarlospsh
josecarlospsh / passUTM.js
Created February 4, 2021 00:21 — forked from dillansimmons/passUTM.js
Pass current UTMS to in page links Javascript
// JS for grabbing utm params and parsing into url
var getRefQueryParam = function() {
var temp = {};
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function() {
var decode = function(s) {
return decodeURIComponent(s.split("+").join(" "));
};
temp[decode(arguments[1])] = decode(arguments[2]);
});
return temp;
@josecarlospsh
josecarlospsh / wp_page_id_by_slug.php
Last active July 29, 2020 02:39
How to get page ID by slug in Wordpress
<?php
function get_page_id_by_slug( $page_slug ) {
$page = get_page_by_path( $page_slug );
if ( $page ) {
return $page->ID;
} else {
return null;
}
}
?>
@josecarlospsh
josecarlospsh / rm_pcf.php
Created November 26, 2019 05:22
Remove p tag from CF7
<?php
//add following line to your wp-config.php file
define( 'WPCF7_AUTOP', false );
?>
@josecarlospsh
josecarlospsh / rm_spancf.php
Last active November 26, 2019 05:20
Remove span tag from CF7
<?php
/*Remove <span></span> tag from Contact Form 7*/
add_filter('wpcf7_form_elements', function($content) {
$content = preg_replace('/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content);
$content = str_replace('<br />', '', $content);
return $content;
});
?>
<?php
function my_custom_submenu() {
global $post;
$menu_items = wp_get_nav_menu_items('Menu');
$current_menu_id = 0;
// get current top level menu item id
foreach ( $menu_items as $item ) {

Finishing this guide you'll get:

  • A running WordPress installation
  • Nginx proxy with PHP and Fast CGI
  • MySQL server accessible with phpMyAdmin

Specification of latest running installation:

  • Date: 03.03.2014