Skip to content

Instantly share code, notes, and snippets.

View kirasiris's full-sized avatar
😍
In love with JavaScript!!

Kevin Uriel Fonseca kirasiris

😍
In love with JavaScript!!
View GitHub Profile
// Desabilita F12
document.onkeypress = function (event) {
event = (event || window.event);
if (event.keyCode == 123) {
//alert('No F-12');
return false;
}
}
document.onmousedown = function (event) {
event = (event || window.event);
<?php
function kuaf_post_tags_meta_box_remove() {
$id = 'tagsdiv-post_tag'; // you can find it in a page source code (Ctrl+U)
$post_type = 'post'; // remove only from post edit screen
$position = 'side';
remove_meta_box( $id, $post_type, $position );
}
add_action( 'admin_menu', 'kuaf_post_tags_meta_box_remove');
function kuaf_add_new_tags_metabox(){
<?php
// Filtrar Post por Date Range
class kuafDateRange{
function __construct(){
// if you do not want to remove default "by month filter", remove/comment this line
add_filter( 'months_dropdown_results', '__return_empty_array' );
// include CSS/JS, in our case jQuery UI datepicker
<?php
// Desabilitar accesso publico a REST API /wp-json
function kuaf_restricted_rest_api_access( $access ) {
return new WP_Error( 'rest_cannot_access', 'Lo siento pero he bloqueado el REST API de la website para evitar el accesso publico al contenido de la website', array(
'status' => 403
) );
}
add_filter( 'rest_authentication_errors', 'kuaf_restricted_rest_api_access' );
<?php
// Filtrar Posts por Author
function kuaf_filter_by_the_author() {
$params = array(
'name' => 'author', // Este es el atributo "name" para el <select>
'show_option_all' => 'All authors' // Label para todos los authores(muestra posts sin filtro)
);
if ( isset($_GET['user']) )
$params['selected'] = $_GET['user']; // Elije usuario seleccionado mediante la variable $_GET
<div class="alert alert-info">
<p>
<?php
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms); echo "Hay <span>".$numcomms."</span> comentarios en total en "; bloginfo('name');
?>
</p>
</div>
<!--
This technique is required in order to show content from a page(usually home(English) or inicio(Spanish) in the front-page.php file)
-->
<!-- The main content div -->
<?php global $post; ?>
<?php if($post->post_content): ?>
<?php if(have_posts()) : the_post(); ?>
<div class="container">
<div class="row">
<article>
@kirasiris
kirasiris / removeparagraphtagsinwordpressexcerpt.php
Created January 21, 2018 03:04
How to remove paragraph tags in Wordpress excerpt
<?php echo(get_the_excerpt()); ?>
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Template
{
var $ci;
function __construct()
<?php
// Funcion para buscador. El input de buscar buscara la keyword unicamente en los post
function search_filter( $query ) {
if ( !is_admin() && $query->is_main_query() ) {
if ( $query->is_search ) {
$query->set( 'post_type', array( 'post ', 'portfolios' , 'videos' , 'clients' , 'snippets' ) );
}
}
}
add_action( 'pre_get_posts','search_filter' );