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 / 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. :/
@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 / 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 / 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 />';