Skip to content

Instantly share code, notes, and snippets.

View daniloroddrigues's full-sized avatar

Danilo Rodrigues daniloroddrigues

  • Full Stack Developer
View GitHub Profile
@daniloroddrigues
daniloroddrigues / functions.php
Created December 4, 2023 19:01 — forked from vishalbasnet23/functions.php
User Registration Front End WordPress with Ajax
<?php
add_action('wp_ajax_register_user_front_end', 'register_user_front_end', 0);
add_action('wp_ajax_nopriv_register_user_front_end', 'register_user_front_end');
function register_user_front_end() {
$new_user_name = stripcslashes($_POST['new_user_name']);
$new_user_email = stripcslashes($_POST['new_user_email']);
$new_user_password = $_POST['new_user_password'];
$user_nice_name = strtolower($_POST['new_user_email']);
$user_data = array(
'user_login' => $new_user_name,
@daniloroddrigues
daniloroddrigues / form.php
Created March 24, 2022 19:02 — forked from kharakhordindemo/form.php
Remove span in Contact Form 7
/*Contact form 7 remove span*/
add_filter('wpcf7_form_elements', function($content) {
$content = preg_replace('/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content);
$content = str_replace('<br />', '', $content);
return $content;
});
@daniloroddrigues
daniloroddrigues / wrapper_image.php
Last active April 22, 2024 18:19 — forked from cabans/Add Pinterest Button to all Images in the_content()
Wordpress - Function to wrap all images and adds Pinterest button
// Wordpress - Function to wrap all images and adds Pinterest button
// Add Pinterest Button to all Images in the_content()
// Wraps image with container and add link to share src from all <img> in the content
function gear_pinterest_in_content_images($content) {
$dom = new DOMDocument('UTF-8');
@$dom->loadHTML( utf8_decode($content) ); // Decode to simple ISO to avoid accent errors
$dom->preserveWhiteSpace = false;
$images = $dom->getElementsByTagName('img');
@daniloroddrigues
daniloroddrigues / app.js
Created April 5, 2021 02:43 — forked from ozknozsrt/app.js
WordPress API - how to fetch and paginate posts with Vue.js
import Vue from 'vue';
import posts from './components/posts.vue';
window.axios = require('axios');
window.Vue = Vue;
Vue.component('posts', posts);
const app = new Vue({
el: '#app',
@daniloroddrigues
daniloroddrigues / django_permissions.py
Last active February 9, 2021 20:30 — forked from Drunpy/django_permissions.py
Exemplo de implementação de Grupos e Permissões no Django.
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
# PERMISSÕES
# Permissões geralmente são usadas para fazer controle de acesso.
# Exemplo prático: Num sistema de gerenciamento a área de marketing pode acessar
# a área de Analytics da empresa.
# Implementação prática com as permissões do Django.