Skip to content

Instantly share code, notes, and snippets.

View larbous's full-sized avatar

Luiz Sobral larbous

View GitHub Profile
@larbous
larbous / Contador de Views para WordPress Posts e CPT.php
Created July 4, 2024 12:34
Contador de Views para WordPress Posts e CPT
/*Desenvolvido por Dante Testa + ASK Jarvis*/
/*Coloque esse código no functions.php do seu tema */
/*https://www.youtube.com/watch?v=NKxyNbJbee4 */
function views_shortcode( $atts ) {
$a = shortcode_atts( array(
'print' => '0',
'count' => '0',
), $atts );
@larbous
larbous / custom-dynamic-field-callback.php
Created July 9, 2024 01:11 — forked from Crocoblock/custom-dynamic-field-callback.php
JetEngine Dynamic Field add custom callback (for example, add callback that partially masks an email with * or other symbols)
<?php
//filter to add a callback to the list
add_filter( 'jet-engine/listings/allowed-callbacks', 'add_custom_dynamic_field_callbacks' );
//filter to specify which arguments will the callback have
add_filter( 'jet-engine/listing/dynamic-field/callback-args', 'add_custom_dynamic_field_callbacks_args', 0, 3 );
//filter to add controls
//controls arguments are set as in Elementor controls
@larbous
larbous / shortcode_pagina_html.php
Created July 10, 2024 13:30
WP JetEngine - Shortcode que imprime um campo com html puro com JS, CSS sem remover as tags html
<?php
//use para imprimir um campo JetEngine Textarea com somente html
function pagina_html_shortcode() {
//campo meta
$meta_key = '_pagina_html';
//recupera o campo
$value = get_post_meta(get_the_ID(), $meta_key, true);
return $value;
@larbous
larbous / options-values-in-code.php
Created July 10, 2024 14:51 — forked from MjHead/options-values-in-code.php
Get option values for JetEngine options pages inside the PHP code
<?php
/**
* Method 1
* Can be used for: Any storage type
*
* page-slug - replace this with your Option Page slug
* option-name - replace this with your option Name/ID
*/
$value = jet_engine()->listings->data->get_option( 'page-slug::option-name' );