Skip to content

Instantly share code, notes, and snippets.

View haciyevmayis's full-sized avatar

Mayis Hajiyev haciyevmayis

View GitHub Profile
@haciyevmayis
haciyevmayis / remove_checkout_fields.php
Created April 27, 2022 08:10 — forked from cryptexvinci/remove_checkout_fields.php
Remove fields from WooCommerce checkout page.
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
function custom_remove_woo_checkout_fields( $fields ) {
// remove billing fields
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
@haciyevmayis
haciyevmayis / admin.js
Created April 23, 2022 08:56 — forked from vralle/admin.js
Adding a Media Button to the WordPress Editor.
jQuery(function($) {
$(document).ready(function(){
$('#insert-my-media').click(open_media_window);
});
function open_media_window() {
if (this.window === undefined) {
this.window = wp.media({
title: 'Insert a media',
library: {type: 'image'},
@haciyevmayis
haciyevmayis / .htaccess
Created April 13, 2022 06:53 — forked from danielmcclure/.htaccess
High Security .htaccess Configuration for WordPress Sites (Requires Edits)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Scroll To Text Fragment</title>
<style>
* {
box-sizing: border-box;
}
<?php
//Insert ads after second paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {
$ad_code = '<div>Ads code goes here</div>';
if ( is_single() && ! is_admin() ) {
return prefix_insert_after_paragraph( $ad_code, 2, $content );
}
return $content;
}
@haciyevmayis
haciyevmayis / wp-ajax-loadmore.md
Created March 3, 2022 10:18 — forked from aslamdoctor/wp-ajax-loadmore.md
Wordpress - AJAX Load More Steps

Step 1. Load more button

<?php
global $wp_query; // you can remove this line if everything works for you
 
// don't display the button if there are not enough posts
if (  $wp_query->max_num_pages > 1 )
	echo '<div class="misha_loadmore">More posts</div>'; // you can use <a> as well
?>