Skip to content

Instantly share code, notes, and snippets.

View josepedrodiaz's full-sized avatar
💭
Coding

Pedro Díaz josepedrodiaz

💭
Coding
View GitHub Profile
@josepedrodiaz
josepedrodiaz / Setup-white-canvas-readme.md
Last active June 3, 2025 15:03
Steps to Set Up the White Canvas Project Locally

Steps to Set Up the Project Locally

Follow these instructions to get your local WordPress environment up and running.

1. Clone the Repository

git clone https://your-repo-url.git

cd link-up-lab

🧹 Why and How to Clean Text When Pasting from Word to WordPress

Why Clean the Text?

When you copy content from Microsoft Word or similar word processors and paste it directly into the WordPress WYSIWYG editor, hidden formatting and HTML code can be carried over. This can lead to:

  • Inconsistent styling on your website
  • Unwanted fonts, colors, and sizes
  • Extra HTML tags that complicate your site's code
@josepedrodiaz
josepedrodiaz / flexible_modules.php
Last active October 10, 2023 19:52
Get flexible modules in use
<?php
/*
* Displays an array of used modules
*/
function display_used_modules() {
//Name of the flexible content field
$flexible_content_field_name = 'modules';
echo 'Used modules <br />';
@josepedrodiaz
josepedrodiaz / coloring_nodes.css
Last active November 8, 2022 13:39
Coloring nodes in a page to test layout
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
@josepedrodiaz
josepedrodiaz / wp_noindex_password_protected_posts.php
Created February 21, 2022 19:39
No index password protected posts
<?php
/**
* Noindex protected posts
*/
add_filter( 'wp', function()
{
global $post;
if(!empty($post->post_password)){
add_filter( 'wp_robots', 'wp_robots_no_robots' );
}
@josepedrodiaz
josepedrodiaz / get_with_curl.php
Last active February 21, 2022 19:43
Get with curl
<?php
/**
* Source https://gist.github.com/tineo/5234972
*/
public static function getWithCurl($url)
{
$curl = curl_init();
// Setup headers - I used the same headers from Firefox version 2.0.0.6
// below was split up because php.net said the line was too long. :/