Skip to content

Instantly share code, notes, and snippets.

View luispaiva's full-sized avatar

Luis Paiva luispaiva

View GitHub Profile
@luispaiva
luispaiva / get_primary_taxonomy_term.php
Created February 15, 2022 21:58 — forked from tarecord/get_primary_taxonomy_term.php
Returns the primary term for the chosen taxonomy set by Yoast SEO or the first term selected.
<?php
/**
* Returns the primary term for the chosen taxonomy set by Yoast SEO
* or the first term selected.
*
* @link https://www.tannerrecord.com/how-to-get-yoasts-primary-category/
* @param integer $post The post id.
* @param string $taxonomy The taxonomy to query. Defaults to category.
* @return array The term with keys of 'title', 'slug', and 'url'.
*/
@luispaiva
luispaiva / functions.php
Created June 25, 2021 20:46 — forked from keesiemeijer/functions.php
Insert HTML between paragraphs in WordPress post content
<?php
/**
* Insert HTML between paragraphs in WordPress post content using php DOMDocument().
*
* Inserts HTML in the middle of top level paragraphs.
* For example:
*
* <p>Hello</p>
* <blockquote>
* <p>Awesome</p><!-- not a top level paragraph -->
@luispaiva
luispaiva / lamp.sh
Created December 5, 2020 14:50 — forked from UbuntuEvangelist/Completely Uninstall LAMP Stack Ubuntu 24.04 LTS
Completely Uninstall LAMP Ubuntu 18.04 LTS
#!/bin/bash
# This will remove Apache
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt remove apache2.*
sudo apt-get autoremove
whereis apache2
sudo rm -rf /etc/apache2
@luispaiva
luispaiva / example-wp-list-table.php
Created July 29, 2020 20:35 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@luispaiva
luispaiva / pagseguro-assinatura.php
Created December 12, 2019 03:11 — forked from guiliredu/pagseguro-assinatura.php
Exemplo de pagamento e assinatura pelo PagSeguro com PHP e CURL
<?php
$url = 'https://ws.pagseguro.uol.com.br/v2/pre-approvals/request';
$data['email'] = '[email protected]';
$data['token'] = 'TOKEN';
$data['currency'] = 'BRL';
$data['reference'] = $id_cliente;
$data['senderName'] = $cliente['nome'];
@luispaiva
luispaiva / post-count-bubble.php
Created October 26, 2019 15:59 — forked from derpixler/post-count-bubble.php
Add WordPress Nav-Menu Counter
<?php
/*
Plugin Name: Add Postcount to Adminmenu
Plugin URI: https://gist.github.com/derpixler/6d73b30fee3dcaf6d119
Description: This Plugin adds a count bubble on Post menu
Version: 1.0
Author: René Reimann
Author URI: http://www.rene-reimann.de
License: