Skip to content

Instantly share code, notes, and snippets.

View sarvar's full-sized avatar

Sarvar sarvar

  • Uzbekistan, Tashkent
View GitHub Profile
@sarvar
sarvar / single-category.php
Created February 12, 2017 08:55
Custom single template for a specific category
Put it in function.php
function get_custom_cat_template($single_template) {
global $post;
if ( in_category( 'practise' )) {
$single_template = dirname( __FILE__ ) . '/single-practise.php';
}
return $single_template;
}
add_filter( "single_template", "get_custom_cat_template" ) ;
@sarvar
sarvar / responsive-font.css
Created February 13, 2017 16:12
Responsive font size
@function get-vw($target)
$vw-context: (1200 * 0.01) * 1px
@return ($target / $vw-context) * 1vw
body
font-size: get-vw($default-font-size)
h1
font-size: get-vw($h1-font-size)
h2
font-size: get-vw($h2-font-size)
h3
@sarvar
sarvar / responsive-list.html
Last active February 14, 2017 07:52
Responsive Lists Layout
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="services.html">Services</a></li>
<li><a href="products.html">Products</a></li>
<li><a href="jobs.html">Jobs</a></li>
<li><a href="contact.html">Contact</a></li>
<li id="x" class="x"><a href="privacy.html">Privacy</a></li>
</ul>
@sarvar
sarvar / carousel.php
Last active May 17, 2019 11:17
ACF Repeater field and Bootstrap Carousel
@sarvar
sarvar / login-form.php
Created February 22, 2017 13:17
Customizing the Login Form on Wordpress
function my_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/site-login-logo.png);
padding-bottom: 30px;
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );
@sarvar
sarvar / same-category-posts.php
Created February 25, 2017 19:40
Displaying posts from the same category within a post
<?php
$backup = $post; //backup current object
$current = $post->ID; //current page ID
?>
<?php
global $post;
$thisCat = get_the_category();
$currentCategory = $thisCat[0]->cat_ID;
$myposts = get_posts('numberposts=2&order=DESC&orderby=ID&category=' . $currentCategory . '&exclude=' . $current);
foreach($myposts as $post) :
@sarvar
sarvar / ajax-form.js
Created March 8, 2017 05:04
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@sarvar
sarvar / change-sender-name.php
Created March 8, 2017 19:59
How to Change Sender Name in Outgoing WordPress Email
// Function to change email address
function wpb_sender_email( $original_email_address ) {
return '[email protected]';
}
// Function to change sender name
function wpb_sender_name( $original_email_from ) {
return 'Tim Smith';
}
@sarvar
sarvar / html
Last active March 21, 2017 08:21
Bootstrap 3 Show Many Slide One Carousel
<div class="carousel placeCarousel slide">
<div class="carousel-inner">
<div class="item active">
<div class="col-xs-12 col-sm-6 col-md-4 place">
<a href="#" title="">
<img src="img/img01.jpg" alt="" class="img-responsive" />
<span class="cover"></span>
<span class="name">
Супермаркет <br> «KORZINKA.UZ» <br> (ориентир областная больница)
</span>
@sarvar
sarvar / responsive-bootstrap-carousel.html
Created April 23, 2017 06:04
Responsive Bootstrap Carousel