Skip to content

Instantly share code, notes, and snippets.

@ferourives
ferourives / modal.html
Last active July 14, 2022 03:38
Modal Pop up with sessionStorage
<div class='modal' id='modal'>
<!-- MODAL CONTENT -->
<div id="modal-content" class='modal-content'>
<!-- For the close button -->
<span class="modal-close" id='close'>&times;</span>
<!-- Actual content -->
<div>
<a href="#">
<img src="https://picsum.photos/id/237/820/400" alt="Dog">
</a>
@ferourives
ferourives / expansion.js
Created June 9, 2021 13:39
WP Tabs FAQ with tabs, expansion and ACF
//Expansion
const expansionTitle = $('.expansion-component .expansion-component__title')
expansionTitle.first().toggleClass('active');
expansionTitle.first().siblings('.expansion-component__panel').toggleClass('active');
@ferourives
ferourives / list-events.php
Last active July 14, 2022 03:38
List Events by Year and Month Using ACF
<?php
$the_query = new WP_Query( array(
'post_type' => 'calender_item',
'post_status' => 'publish',
'meta_key' => 'calender_item_date',
'orderby' => 'meta_value'
) );
# This will hold what group we're in
@ferourives
ferourives / WP search by title relevance
Last active February 9, 2018 12:53
function to order search results by title
//Ordena busca pelo titulo
add_action( 'pre_get_posts', 'my_change_sort_order');
function my_change_sort_order($query){
if(is_search()):
//If you wanted it for the archive of a custom post type use: is_post_type_archive( $post_type )
//Set the order ASC or DESC
$query->set( 'order', 'ASC' );
//Set the orderby
$query->set( 'orderby', 'relevance' );
endif;
@ferourives
ferourives / countdown.php
Last active August 1, 2024 23:45
Event countdown WP loop with datepicker ACF
<!-- competitions countdown with post type "competição" -->
<?php
//If the event is happening
$args = array(
'post_type' => 'competicao',
'meta_query' => [
'relation' => 'AND',
[
'key' => 'date_picker',
'compare' => '<=',