This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MeuPlugin; | |
$voting_page = apply_filters( 'voting_page', 'create-voting' ); | |
define( 'MEUPLUGIN_VOTING_PAGE', $voting_page ); | |
function add_rewrite() | |
{ | |
add_rewrite_rule('^concordamos/' . CONCORDAMOS_VOTING_PAGE . '/?', 'index.php?voting_page=1', 'top'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p1_eixo | |
p12_uf | |
p16_bairro | |
p16_cidade | |
p16_estado | |
p16_internacional | |
p16_nacional | |
p17_ano | |
p18_agrario | |
p18_comunicacao |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function filter_excerpt_more( $more ) { | |
global $post; | |
if ( is_front_page() ) { | |
if ( ! ( 'deputado' == $post->post_type ) ) { | |
return $more; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_endpoint_init() { | |
register_rest_route( 'meusite/v1', '/graficos/', array( | |
'methods' => 'GET', | |
'callback' => 'minha_funcao_de_resposta', | |
'args' => array( | |
'meta' => array( | |
'validate_callback' => function($param, $request, $key) { | |
return is_string( $param ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_locate_template', 'custom_woocommerce_locate_template', 10, 3 ); | |
function custom_woocommerce_locate_template( $template, $template_name, $template_path ) { | |
global $woocommerce; | |
$_template = $template; | |
if ( ! $template_path ) $template_path = $woocommerce->template_url; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Partial template for content in page.php | |
* | |
* @package UnderStrap | |
*/ | |
// Exit if accessed directly. | |
defined( 'ABSPATH' ) || exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$api_key = 'YOUR_API_KEY'; | |
$url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'; | |
$pattern = '/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^\&\?]*).*/'; | |
preg_match($pattern, $url, $matches); | |
$video_id = $matches[7]; | |
$url = "https://www.googleapis.com/youtube/v3/videos?id=$video_id&key=$api_key&part=snippet"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker-compose exec mariadb mysqldump -uwordpress -pwordpress wordpress > ./dump.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt install pdftk [On Debian, Ubuntu and Mint] | |
$ sudo yum install pdftk [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] | |
$ sudo emerge -a app-text/pdftk [On Gentoo Linux] | |
$ sudo apk add pdftk [On Alpine Linux] | |
$ sudo pacman -S pdftk [On Arch Linux] | |
$ sudo zypper install pdftk [On OpenSUSE] | |
$ pdftk <path-to-protected-filename>.pdf input_pw <yourpassword> output <path-to-newfilename>.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_search_filter( $query ) { | |
global $wpdb; | |
if ( $query->is_search() && ! is_admin() ) { | |
$search_query = get_search_query(); | |
$results = $wpdb->get_results( | |
$wpdb->prepare( | |
"SELECT p.ID, p.post_title, m.meta_value | |
FROM {$wpdb->prefix}posts AS p |