Skip to content

Instantly share code, notes, and snippets.

View sarvar's full-sized avatar

Sarvar sarvar

  • Uzbekistan, Tashkent
View GitHub Profile
@sarvar
sarvar / script.js
Created June 12, 2022 16:22
owl-carousel only for mobile
/*
And a bit of CSS to show disabled Owl element:
.owl-carousel.off {
display: block;
}
*/
$(function() {
var owl = $('.owl-carousel'),
@sarvar
sarvar / mysql.txt
Created October 10, 2021 07:17
Changing WordPress URLs in MySQL Database
UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');
UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');
@sarvar
sarvar / functions.php
Created September 28, 2020 19:03
Disable individual theme update notification WordPress
function disable_theme_update_notification( $value ) {
if ( isset( $value ) && is_object( $value ) ) {
unset( $value->response['themename'] );
}
return $value;
}
add_filter( 'site_transient_update_themes', 'disable_theme_update_notification' );
@sarvar
sarvar / file.txt
Created August 4, 2020 12:11
How to fix "ReferenceError: primordials is not defined" error
In the same directory where you have package.json create an npm-shrinkwrap.json file with the following contents:
{
"dependencies": {
"graceful-fs": {
"version": "4.2.2"
}
}
}
@sarvar
sarvar / index.php
Created July 31, 2020 10:42
Highlight custom post type parent as active item in Wordpress Navigation
function remove_parent($var)
{
if ($var == 'current_page_parent' || $var == 'current-menu-item' || $var == 'current-page-ancestor') { return false; }
return true;
}
function tg_add_class_to_menu($classes)
{
if (is_singular('projects'))
{
@sarvar
sarvar / index.html
Created July 26, 2020 21:46
Sticky Footer with Flexbox
<div class="content">
<h1>Sticky Footer with Flexbox</h1>
<p><button id="add">Add Content</button></p>
</div>
<footer class="footer">
Footer
</footer>
@sarvar
sarvar / index.html
Created March 24, 2020 11:41
Wordpress: post thumbnail in background-image
<div class="quote big" style="background-image: url('<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>');">
</div>
@sarvar
sarvar / index.txt
Created December 16, 2019 10:40
13 ways to vertical center
https://blog.logrocket.com/13-ways-to-vertical-center-in-2018-cb6e98ed8a40/
@sarvar
sarvar / script.js
Created December 3, 2019 19:47
Disable aos on mobile view
AOS.init({
disable: function() {
var maxWidth = 992;
return window.innerWidth < maxWidth;
}
});
@sarvar
sarvar / index.html
Created October 17, 2019 06:38
Equal img height
<div class="section-item__photo">
<img .../ >
</div>