Skip to content

Instantly share code, notes, and snippets.

View bryanrsebastian's full-sized avatar

Bryan Sebastian bryanrsebastian

View GitHub Profile
$( document ).ready( function() {
/** Features Recent Posts Search Functionality **/
$( '#__search_recent' ).keyup( function( event ) {
var search = $( this ).val().toUpperCase();
$( '#features_archive .__recent_post_sub_container' ).each( function( index, el ) {
if( $( 'a', el ).text().toUpperCase().indexOf( search ) > -1 ) {
$( el ).show();
// $(".__recent_post_sub_container:nth-of-type(11)").addClass('hide-post');
// $(".__recent_post_sub_container:nth-of-type(12)").addClass('hide-post');
$(".__recent_post_sub_container:nth-of-type(11)").removeClass('hide-post-hidden');
@bryanrsebastian
bryanrsebastian / Custom Radio Button - CSS
Created January 11, 2021 02:00
Custom Radio Button
.__radio_field {
border: 1px solid #767676;
padding: 8px 15px;
input {
position: absolute;
width: 0;
height: 0;
opacity: 0;
cursor: default;
&:checked ~ label {
@bryanrsebastian
bryanrsebastian / Custom Select - HTML
Last active January 11, 2021 01:59
Custom Select
<div class="__select_field">
<div class="__select">
<p class="__selected" data-selected="all-locations">All Locations</p>
<div class="__select--list">
<div>
<p data-value="all-locations">All Locations</p>
<p data-value="location-1">Location 1</p>
<p data-value="location-2">Location 2</p>
<p data-value="location-3">Location 3</p>
<p data-value="location-4">Location 4</p>
if (!is_admin()) {
function defer_parsing_of_js($url) {
if (FALSE === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return "$url' defer='defer";
}
add_filter('clean_url', 'defer_parsing_of_js', 11, 1);
}
UPDATE wp_options SET option_value = replace(option_value, 'https://livesite.com', 'http://localhost/sitename') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'https://livesite.com','http://localhost/sitename');
UPDATE wp_posts SET post_content = replace(post_content, 'https://livesite.com', 'http://localhost/sitename');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'https://livesite.com', 'http://localhost/sitename');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'https://livesite.com', 'http://localhost/sitename');
easyweb-italia
4764fbb159e067e22458285444e844c313f26d6d
@bryanrsebastian
bryanrsebastian / Sticky header js
Created June 8, 2018 02:11
Add class to header to design it and to become sticky
$( window ).scroll( function() {
if ( $(window).scrollTop() <= 50 ) {
$( 'header' ).removeClass( 'sticky' );
} else {
$( 'header' ).addClass( 'sticky' );
}
} );
@bryanrsebastian
bryanrsebastian / Wordpress Pagination with "First" and "Last"
Last active September 22, 2018 03:38
This snippets is compatible even there is a year and month in the url.
/**
* Add first and last button to the
* default pagination of wordpress
*
* Note: Don't forget to initialize your default
* query to limit your post in pre_get_post hook
*
* @var string $post_type name of your post type
* @var int $total_post number of total post to get the number of pagination
* @return void pagination
@bryanrsebastian
bryanrsebastian / Auto height element
Last active September 13, 2018 01:22
Make the height of all elements with the selected class becomes automatic depends on the maximum height.
jQuery( function( $ ) {
if( $( window ).width() > 750 ) {
autoHeight( '.__your_class' );
} else {
$( '.__your_class' ).height( 'auto' );
}
$( window ).resize( function() {
if( $( window ).width() > 750 ) {
autoHeight( '.__your_class' );