Skip to content

Instantly share code, notes, and snippets.

@axxe16
axxe16 / protezione
Last active Nov 5, 2020
Protezione con Password di cartella tramite htaccess #apache #password #folder
View protezione
1) creo file .htaccess dove
- AuthUserFile indica path del server in cui c'è la password
- AuthGroupFile indica il path del server relativo alla cartella da proteggere
AuthUserFile /home/www/fbsr/prod/test/.htpassword
AuthGroupFile /home/www/fbsr/prod/test/
AuthName "Directory Protetta"
AuthType Basic
<Limit GET>
require valid-user
@axxe16
axxe16 / template.php
Last active Nov 5, 2020
Loop che cicla una custom taxonomy e tutti i post relativi #loop #wp #custom_taxonomy #custom_type
View template.php
<?php
$cat_ricette = get_terms( 'categorie' );
foreach ( $cat_ricette as $cat_ricetta ) {
$query = new WP_Query( array(
'post_type' => 'ricette',
'posts_per_page' => '-1',
'tax_query' => array(
array(
'taxonomy' => 'categorie',
'field' => 'slug',
@axxe16
axxe16 / functions.php
Last active Nov 5, 2020
Rimuove supporto ai TAG nei post #remove #tag #article #post
View functions.php
<?php
// Remove tags support from posts
// *****
function myprefix_unregister_tags() {
unregister_taxonomy_for_object_type('post_tag', 'post');
}
add_action('init', 'myprefix_unregister_tags');
@axxe16
axxe16 / scripts.js
Created Sep 25, 2020
verifica se un elemento fixed su un area #js #fixed #sniff #ishover #jQuery #js #javascript
View scripts.js
//restituisce true quando elemento fixed passa sopra ad element
//fixed si passa così $("#rightMenu")
//element si passa sempre così $('#s02')
function isHover(fixed, element) {
var isHover = false;
if ( element.length ) {
var fixed_position = fixed.offset().top;
var fixed_height = fixed.height();
@axxe16
axxe16 / function.php
Created Sep 11, 2020
Recuperare campi ACF su immagini e allegati con WPML attivo #wpml #acf #attachment #immagini
View function.php
<?php
if( ICL_LANGUAGE_CODE == 'it' ) {
$link = get_field('link_ita', apply_filters( 'wpml_object_id', $image['ID'], 'attachment', TRUE, 'it' ));
} elseif( ICL_LANGUAGE_CODE == 'en' ) {
$link = get_field('link_en', apply_filters( 'wpml_object_id', $image['ID'], 'attachment', TRUE, 'en' ));
}
@axxe16
axxe16 / css.css
Created Sep 2, 2020
goTop - pulsante torna su #gotop #up #js #button
View css.css
.goUp {
position: fixed;
right: 20px;
bottom: 20px;
font-size: 30px;
color: $blue;
padding: 0 9.3px;
z-index: 999;
background-color: rgba(0, 0, 0, .3);
-webkit-border-radius: 8px;
@axxe16
axxe16 / style.scss
Last active Jul 28, 2020
Permette di trasformare il modal in un layer a tutto schermo #modal #bootstrap #fullscreen #css #bootstrap4
View style.scss
.modal-dialog {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
max-width: none !important;
.modal-content {
height: auto;
min-height: 100%;
@axxe16
axxe16 / style.css
Created Jul 28, 2020
Permette di trasformare il modal in un layer a tutto schermo #modal #bootstrap #fullscreen #css #bootstrap4
View style.css
.modal-dialog {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
max-width: none !important;
}
.modal-content {
height: auto;
@axxe16
axxe16 / functions.php
Created Jul 8, 2020
Sub pagina optioni ACF in impostazioni #acf #function #options
View functions.php
<?php
//aggiunge una pagina option dentro la sezione impostazioni
if( function_exists('acf_add_options_page') ) {
acf_add_options_sub_page(array(
'page_title' => 'Impostazioni Tema',
'menu_title' => 'Impostazioni Tema',
'parent_slug' => 'options-general.php',
));
}
@axxe16
axxe16 / functions.php
Created May 15, 2020
Crea filtro di ricerca per un campo ACF object #acf #filter #backend
View functions.php
//Crea filtro dropdown backend per un campo ACF di tipo object
/** Create the filter dropdown */
add_action( 'restrict_manage_posts', 'wpse45436_admin_posts_filter_restrict_manage_posts' );
<?php
function wpse45436_admin_posts_filter_restrict_manage_posts(){
global $post;
$type = 'materiale';
if (isset($_GET['post_type'])) {
$type = $_GET['post_type'];
}
You can’t perform that action at this time.